프로젝트
GitHub에서 보기
adriancooney/voyeur.js
소개
Voyeur는 DOM을 본래 의도된 방식으로 탐색하고 조작할 수 있게 해 주는 초소형(1.2kb) JavaScript 라이브러리입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalVoyeur
http://adriancooney.github.io/voyeur.js
Voyeur is a tiny (1.2kb) Javascript library that lets you traverse and manipulate the DOM the way it should have been. See here for a demo, more information and documentation.
Warning
Voyeur is a great concept but I highly recommend you avoid it in production. There is serious performance issues yet to be worked out. See here.
Example
<body>
<div>
<header>
<h1 id="title"><em><a href="/">Hello world!</a></em></h1>
</header>
<section>
<ul>
<li class="item"><a href="#">Navigation Item</a></li>
<li class="item"><a href="#">Navigation Item</a></li>
<li class="item"><a href="#">Navigation Item</a></li>
<li class="item"><a href="#">Navigation Item</a></li>
<li class="item"><a href="#">Navigation Item</a></li>
</ul>
</section>
</div>
</body>
//Lets get the title link
Voyeur.div.header.h1.em.a.href = "http://google.com"
Voyeur.find("#title").em.a.innerText = "New title!";
//Let's get those navigation items
Voyeur.div.section.ul.li.use(function(li, i) {
li.a.innerText = "Link #" + i;
});
Voyeur.div.section.ul.li.eq(3).classList.add("Highlighted!");
//How about we create some content
var content = Voyeur.create.div
.section.mult(5).p.em.use(function(em) {
em.textContext = "Hello world!";
});
Voyeur.div.appendChild(content);
Usage
Install via bower (courtesy of @pid)
bower install Voyeur
Install via component
component install dunxrion/voyeur.js
Include the script somewhere on the page.
<script type="text/javascript" src="Voyeur.min.js"></script>
Outside
Voyeur has managed to inspire a couple of other spin-off projects.
- https://gist.github.com/yckart/6627671 - @yckart managed to whittle down the basic functionality to an incredibly 140 bytes.
- http://nbubna.github.io/HTML/ - @nbubna has created HTML.js, check it out, it's worth it.
Todo
- Make Voyeur handle DOMSubtreeModified DOM changes with
MutationObserver.
License
관련 프로젝트 살펴보기
불러오는 중…