How and what benefit can I take by including Sizzle.js along with jquery1.4.2?

jQuery requires sizzle in order to function. You can take the benefit of a working javascript library.


OK, it was actually pretty unclear what sizzle.js was to me. Basically, what it does is allows you to use javascript on 'selectors', that is, classes, IDs, DOM elements, etc... So when you use this in jQuery:

$('div')

That's sizzle.js at work, making that element available to javascript.

I hope I got that all right :)


Sizzle.js is a JavaScript library that implements a "CSS selector engine designed to be easily dropped in to a host library." jQuery uses it internally for its CSS selection needs. If you wanted a CSS engine and had no need for all the other JavaScript benefits of jQuery, you could use Sizzle.js separately.


Here is the resource for that:

http://wiki.github.com/jeresig/sizzle/

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, etc
* 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