A fast, simple, opinionated selector "engine".
This module provides a simple way to query the DOM for elements by ID, class or tag name only. It was designed to be both small and to force users to make efficient DOM queries, which is useful when developing for mobile devices. It intentionally does not and will never support more complicated ways of querying on the basis that these are slow and can be avoided (also, there are many other projects around which fulfil this job very well already). This module is AMD compatible.
// Queries by ID, class or tag name
ess('#nav'); // returns DOMNode
ess('.current'); //returns DOMNode array
ess('li'); //returns DOMNode array
// Space-separated, drill-down queries
ess('#nav .current'); // returns DOMNode array
ess('#nav li'); // returns DOMNode array
// Specifying a DOM context to perform the query
var navElement = ess('#nav');
ess('li', navElement); // returns DOMNode array
- Qualified selectors:
li.current
(maybe soon) - Non-simplistic selectors:
div > ul
orp + p
- Comma-separated selectors:
input, select, textarea
- Anything else other than atomistic, space-separated selection by ID, class and tag!
Chrome, Firefox - proper list of devices to follow.
- Look at adding simple qualified selector support
- Bonzo version
- Ender integration
- Improve readme
Thanks to...
- umdjs for the AMD bootstrap
- benchmark.js for benchmarking