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

4

21

latest jquery 1.4.2 downloaded from jquery.com comes with Sizzle.js also.

How and what benefit can I take from included Sizzle.js?

Is Sizzle.js a standalone library?

Why it's included inside jquery library, for what purpose?

/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */

while this is mentioned on sizzle.js website

Completely standalone (no library dependencies)

Delitescence answered 4/5, 2010 at 4:54 Comment(0)
I
36

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.

Ish answered 4/5, 2010 at 7:32 Comment(1)
Here's the relevant jQuery 1.3 release blogpost. The jQuery team split off the CSS selector engine and released it as "Sizzle", to quote: "a completely standalone project to be collaborated upon by many library creators and developers".Doerr
L
16

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 :)

Leisurely answered 8/2, 2013 at 18:54 Comment(0)
T
5

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

Temekatemerity answered 4/5, 2010 at 4:56 Comment(0)
L
4

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
Lynnet answered 4/5, 2010 at 4:56 Comment(3)
my question what sizzle.js can which is not possible with jquery.? or sizzle.js is a part of jquery library from starting.Delitescence
@metal-gear-solid: You did not mention that in your question, you just talked about benefits, well sizzle is selector machensim of jquery.Lynnet
you mean many function of jquery will not work without sizzle.js.Delitescence

© 2022 - 2024 — McMap. All rights reserved.