一個純JavaScript CSS選擇器引擎:Sizzle
Sizzle是 jQuery作者John Resig新寫的DOM選擇器引擎,速度號稱業界第一。而且有一個重要的特點就是Sizzle是完全獨立于jQuery的,如果你不想用jQuery,可 以只用Sizzle。非常好用的,壓縮后才3K多點。
特性:
- Completely standalone (no library dependencies)
- Competitive performance for most frequently used selectors
- Only 4KB minified and gzipped
- Highly extensible with easy-to-use API
- Designed for optimal performance with event delegation
- Clear IP assignment (all code held by the Dojo Foundation, contributors sign CLAs)
Selector Features
- CSS 3 Selector support
- Full Unicode support
- Escaped selector support
#id\:value
- Contains text
:contains(text)
- Complex :not
:not(a#id)
- Multiple :not
:not(div,p)
- Not attribute value
[name!=value]
- Has selector
:has(div)
- Position selectors
:first
,:last
,:even
,:odd
,:gt
,:lt
,:eq
- Easy Form selectors
:input
,:text
,:checkbox
,:file
,:password
,:submit
,:image
,:reset
,:button
- Header selector
:header
Code Features
- Provides meaningful error messages for syntax problems
- Uses a single code path (no XPath)
- Uses no browser-sniffing
- Caja-compatible code
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!