zakirt / query

Simple abstraction to querySelectorAll for a more performant and intuitive solution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

query

Solution for leveraging the performance benefits of getElementById, getElementsByTagName, and getElementsByClassName for simple CSS selectors when querying the DOM. Please refer to http://ryanmorr.com/abstract-away-the-performance-faults-of-queryselectorall for more detailed information regarding this project.

Usage

Usage mimics that of your standard selector engine, accepting any CSS selector to query the DOM. The context of the query can be limited by providing a DOM element as an optional second argument:

query('#foo');
query('.foo');
query('.foo.bar');
query('div', element);

An array rather than a node list is returned, making available all the methods of the Array prototype.

License

This project is dedicated to the public domain as described by the Unlicense.

About

Simple abstraction to querySelectorAll for a more performant and intuitive solution

License:The Unlicense


Languages

Language:JavaScript 80.3%Language:HTML 19.7%