Điểm qua chjj/zest: 241 sao trên GitHub, viết chủ yếu bằng JavaScript. An absurdly fast CSS selector engine.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
chjj/zest có 241 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/chjj/zest. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
chjj/zest có phải mã nguồn mở không?
Có — chjj/zest phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/chjj/zest.
chjj/zest còn đang phát triển không?
Commit gần nhất trên chjj/zest là 12.5 năm trước (theo timestamp GitHub). Repo có 14 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
chjj/zest là gì?
chjj/zest (chjj/zest) là dự án JavaScript trên GitHub. Theo mô tả gốc: An absurdly fast CSS selector engine.
Đọc thêm về chjj/zest ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/chjj/zest là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về zest?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về zest.