Differences between jQuery and Zepto
Zepto implements only a subset of jQuery’s proprietary selectors. It’s definitely something to be mindful of.
clone() doesn’t support passing in an argument to clone event handlers.
Unlike jQuery, Zepto doesn’t attempt to do any type inferring from the value stored in the
offset() handles dimensions different to jQuery: it correctly calculates the dimensions of an element that has had its dimensions transformed via CSS and the
transform property (via
getBoundingClientRect()). At the time of writing, jQuery doesn’t; it will return the normally calculated values.
These methods only manipulate the
display property of the element. You can’t pass in an argument for animation.
toggle() isn’t overloaded like jQuery’s.
ajax() returns the native XHR object, not a Zepto wrapped one.
event argument of events
event argument passed to the callback of event handlers is not wrapped with anything Zepto specific.
Zepto provides some convenience methods that jQuery does not. It’s good to know about these before you reach for Underscore or implement them yourself.
Zepto and its host environment
Zepto steps on its host environment by shimming
What’s the best place to use Zepto?
I have found Zepto is mostly at home when developing for mobile exclusivey, and in fact, that was its original desgign goal, to be a lightweight library for mobile browsers.
Want to discuss this post? Just mention me @alexdickson.