Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A tiny, cross-browser, JavaScript library.
branch: master

This branch is 33 commits behind ryanflorence:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
builds
demos
docs
plugins/keyframes
src
tests
vendor
.gitmodules
README.md
build
server.js

README.md

snack.js

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

Features

Tiny!

  • ~3.3kb! (minified, gzipped, can't even see it when it turns to the side)

Elements

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

Events

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

Pub/Sub

  • Publisher objects for application communication

AJAX

  • Cross-browser AJAX
  • JSONP

Utilities

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

Documentation

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

Tests

The tests require node and express to be installed (and submodules to be updated, see above). To run the tests fire up the server (used for all the ajax stuff).

$ node server.js

Building

Building snack requires uglifyjs.

$ ./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

License

MIT Style license.

Copyright

Copyright (c) Ryan Florence

Something went wrong with that request. Please try again.