/sizzle

A sizzlin' hot selector engine.

Primary LanguageJavaScriptOtherNOASSERTION

Sizzle

A pure-JavaScript CSS selector engine designed to be easily dropped in to a host library.

More information: http://sizzlejs.com/

Discussion: http://groups.google.com/group/sizzlejs

Documentation: https://github.com/jquery/sizzle/wiki/Sizzle-Documentation

Browser support: https://github.com/jquery/sizzle/wiki/Sizzle-Documentation#wiki-browsers

Dependencies

In order to build Sizzle, you need to have Node.js/npm latest and git 1.7 or later.
(Earlier versions might work OK, but are not tested.)

Windows users have two options:

  1. Install msysgit (Full installer for official Git) and a binary version of Node.js. Make sure all two packages are installed to the same location (by default, this is C:\Program Files\Git).
  2. Install Cygwin (make sure you install the git and which packages), and a binary version of Node.js.

Mac OS users should install Xcode (comes on your Mac OS install DVD, or downloadable from Apple's Xcode site) and Homebrew. Once Homebrew is installed, run brew install git to install git, and brew install node to install Node.js.

Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source if you swing that way. Easy-peasy.

Building

First, clone a copy of the main Sizzle git repo by running:

git clone git://github.com/jquery/sizzle.git

Install the grunt-cli package so that you will have the correct version of grunt available from any project that needs it. This should be done as a global install:

npm install -g grunt-cli

Enter the Sizzle directory and install the Node dependencies, this time without specifying a global install:

cd sizzle && npm install

Make sure you have grunt installed by testing:

grunt -version

Then, to get a complete, minified (w/ UglifyJS2), linted (w/ JSHint) version of Sizzle, type the following:

grunt

The built version of Sizzle will be put in the dist/ subdirectory, along with the minified copy and associated map file.

Testing

  • run make to pull down QUnit from github, which is the only thing the Makefile does.
  • Open test/index.html in your browser to run the tests.
  • The actual unit tests are in test/unit/selectors.js and test/unit/utilities.js.

Developing with grunt

  • grunt will lint, build, test, and compare the sizes of the built files.
  • grunt jshint will only lint sizzle.js and the tests.
  • grunt watch can be run to re-lint, re-build, and re-test files as you change them.