一个纯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 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!