Skip to content

A tiny, blazing fast CSS matching engine. Useful for event delegation.

Notifications You must be signed in to change notification settings

alpha123/Wildcat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Wildcat is a simple, fast CSS matching engine, weighing in at only 5kb uncompressed and 1kb minified and gzipped.

Wildcat.match(DOMElement, selector)

selector is a small subset of CSS3 selectors:

  • Node name: div
  • Universal selector: *
  • ID selector: #id
  • Class selector: .class
  • Decendant selector: div p
  • Attribute selector (=, !=): input[type=text]
  • Pseudoclasses (:not): p:not(.example)
  • Comma selector: div, p, a
  • Any combination of the above: #id .class:not([type=text]) p.example

Only the = and != attribute selectors are supported, and only the :not pseudoclass. Fortunately, Wildcat is extensible, so if you need more than that, you can implement it without much hassle.

Wildcat is blazing fast, often faster than the browser's native matchesSelector implementation (though recent versions of WebKit tend to beat it). It achieves this by compiling selectors to efficient JavaScript functions.

About

A tiny, blazing fast CSS matching engine. Useful for event delegation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published