A tiny, cross-browser, JavaScript library.
JavaScript HTML CSS Shell
Latest commit 4ede9f5 Feb 25, 2015 @ryanflorence Update README.md
Failed to load latest commit information.
builds Welcome to v1.2.3 Jun 20, 2011
demos ... because sometimes, all you need is a snack. Apr 19, 2011
docs small corrections to snack.create doc example Sep 21, 2011
plugins/keyframes ... because sometimes, all you need is a snack. Apr 19, 2011
src Changed `open.async` to `options.async`, previously written it was re… Mar 18, 2012
tests bind now prepends arguments May 12, 2011
vendor Welcome to v1.2.3 Jun 20, 2011
.gitignore Upgraded npm and express May 9, 2011
.gitmodules ... because sometimes, all you need is a snack. Apr 19, 2011
README.md Update README.md Feb 25, 2015
build ... because sometimes, all you need is a snack. Apr 19, 2011
package.json Welcome to 1.2.2 May 12, 2011



... because sometimes, all you need is a snack.


I don't maintain this, so if you use it, you have assumed maintenence.



  • ~3.4kb! (minified, gzipped)


  • Use any selector engine. Ships with multiple builds (QSA, Qwery, Slick, Sizzle)
  • Several element methods
  • API to add more element methods


  • Cross-browser DOMContentLoaded (domready)
  • Cross-browser DOM events
  • Event Delegation (with or without a selector engine)


  • Publisher objects for application communication


  • Cross-browser AJAX


  • Shallow object merge with snack.extend
  • Prototypal inheritance with Object.create
  • A few other utilities (only those snack uses)


Snack is very well documented. In the repository is a docs folder. Simply open docs/index.html in your browser or visit the Snack Homepage.

Contributing / Testing / Building Snack

Submodules (selector engines)

Because Snack ships with several selector engines, there are submodules for each one. You'll need to first update them to build or test Snack:

From the root of the repository:

$ git submodule init
$ git submodule update


The tests require node >= 0.4.6, npm >= 1.0.0, and submodules to be updated (see above).

To run the tests, install dependencies and fire up the server (used for all the ajax stuff).

$ npm install .
$ node server.js


Build snack like so:

$ ./build

The tests do not require you to build snack.

Inspiration and code snatching from:

  • MooTools (c) Valerio Proietti, MIT license
  • jQuery (c) John Resig, Dual license MIT or GPL Version 2
  • Zepto (c) Thomas Fuchs, MIT License
  • ContentLoaded (c) Diego Perini, MIT License


MIT Style license.


Copyright (c) Ryan Florence