An open-source entry in TopGit's GitHub warehouse: chjj/zest, 241 stars, JavaScript. An absurdly fast CSS selector engine.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
NOTE: If you want to run these benchmarks yourself make sure to turn off
Sizzle's (and Zest's) document.querySelectorAll delegation mechanism,
otherwise you will be benchmarking against document.querySelectorAll.
Zest will cache compiled selectors if it can't delegate to
document.querySelectorAll, document.getElementById, or
document.getElementsByClassName (depending). The benchmark tests you see
above were performed with the caching mechanism disabled. If caching were
enabled, Zest would be faster than the native document.querySelectorAll.
Install
$ npm install zest
Notes
Zest currently includes support for ender.js, Prototype, and jQuery.
Unsupported Selectors::hover, :active, :link, :visited, all pseudo
elements, and namespaces.
:link, :visited, and pseudo elements are unsupported for obvious reasons
(they don't work). :hover and :active aren't supported because they examine
a dynamic state, you should be binding to events for this (:focus is
supported, but there is no fallback for legacy browsers).
Extension
Zest doesn't support (m)any non-standard selectors, but it is possible to add
your own.
Adding a simple selector
Adding simple selectors is fairly straight forward. Only the addition of pseudo
classes and attribute operators is possible. (Adding your own "style" of
selector would require changes to the core logic.)
Here is an example of a custom :name selector which will match for an
element's name attribute: e.g. h1:name(foo). Effectively an alias
for h1[name=foo].
// if there was a parameter,
// it gets closured as `param`
zest.selectors[':name'] = function(param) {
return function(el) {
if (el.name === param) return true;
};
};
NOTE: if you're pseudo-class does not take a parameter, there will be no
closure.
Adding an attribute operator
// `attr` is the attribute
// `val` is the value to match
zest.operators['!='] = function(attr, val) {
return attr !== val;
};
Adding a combinator
Adding a combinator is a bit trickier. It may seem confusing at first because
the logic is upside-down. Zest interprets selectors from right to left.
Here is an example how a parent combinator could be implemented:
zest.combinators['<'] = function(test) {
return function(el) { // `el` is the current element
el = el.firstChild;
while (el) {
// return the relevant element
// if it passed the test
if (el.nodeType === 1 && test(el)) {
return el;
}
el = el.nextSibling;
}
};
};
The test function tests whatever simple selectors it needs to look for, but
it isn't important what it does. The most important part is that you return
the relevant element once it's found.
Contribution and License Agreement
If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. </legalese>
License
(c) Copyright 2011-2012, Christopher Jeffrey (MIT Licensed).
See LICENSE for more info.
The most recent commit recorded on chjj/zest was 12.5 years ago, based on the GitHub push timestamp. The repository has 14 forks — one of the better signals of community interest.
How many stars does chjj/zest have?
chjj/zest has 241 GitHub stars — refresh the page for the live number, or check github.com/chjj/zest. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is chjj/zest open source?
Yes — chjj/zest ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/chjj/zest.
What is chjj/zest?
chjj/zest (chjj/zest) is a JavaScript project on GitHub. From the project's own README: An absurdly fast CSS selector engine.
Where do I read more about chjj/zest?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/chjj/zest is the definitive source.
Read full README in the tab above.
Want a second opinion on zest?
Ask an AI that can read this page — one click and you get its take on zest.