Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of script.aculo.us, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Freckle Time Tracking and Every Time Zone and write books like Retinafy.me.
   Want me to speak at your conference? Contact me!

Zepto.js, a minimalist JavaScript framework for mobile WebKit browsers

September 21st, 2010

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.

I’d love if you let me know about your ideas and feature requests about this! Please tweet @zeptojs or email me. And please go ahead and fork as much as you can on GitHub!