Zepto.js, a minimalist JavaScript framework for mobile WebKit browsers
Mobile WebKit based browsers (like those on the iPhone/iPad, Android and Palm webOS) provide really powerful DOM, JavaScript and CSS features. So why not use them in a framework, that’s specifically crafted for these modern mobile devices?
The ultimate goal really is to have a ~2k library that handles most basic dredge work for you in a nice API so you can concentrate on getting stuff done.
Say hello to Zepto.js! (grab the raw code).
Zepto.js supports jQuery-like syntax and API(including chaining) so if you used/seen that before, it’s easy to get started:
$('some CSS selector').append('<li>a new li element</li>')
.live('touchstart', function(){ alert(this.innerHTML) });
$.getJSON('/some/service.json', function(obj){ /* do stuff */ });Supported are basic operations like html, append, prepend, css, event delegation with live, transform-based animations with anim and ajax calls (get, post, getJSON). And all of this, thanks to WebKit’s rich features, in just 52 lines of code.
It weighs in at just half a kilobyte when minified and gzipped.
Because it’s so small, it’s easy to just stick it in a script tag directly. Of course, it’s certainly not complete yet, but what’s there already works quite nicely.