Selector library in 233 bytes (minified + gzip)
Due to querySelector the min version is IE 8, Chrome 1 or Firefox 3.5.
Download ayy2.min.js
.
Given the following document:
<div id="main">
<div class="article">
<h3>Article #1</h3>
<p>blahblahblah</p>
<p>blahblahblah</p>
</div>
<div class="article">
<h3>Article #2</h3>
<p>something something irrelevant content</p>
</div>
</div>
Select main container:
Ayy('#main')
All articles:
Ayy('.article', 'all')
It's basically document.querySelector
, so feel free to use any CSS selector.
Feeling adventurous? Clutter Extend the prototype of every html element and unlock amazing features™!
HTMLElement.prototype.Ayy = Ayy;
Ayy('#main').Ayy('.article').Ayy('p', 'tag')