Categories
Programming

jQuery 1.1 – Slimmer and faster

Version 1.1 of my my preferred javascript library, jQuery, was released today.  They have a great motto – “write less, do more” and as far as I can tell, they live up to it.  The release notes claim speed improvements of 10-20x for selectors over those in 1.0.4.  The release includes some interesting new features – such as passing functions for an attribute or a css property.  The flexibility of that is mind-boggling, but it could also lead to some hard to maintain code in the wrong hands.

Why do I like jQuery over say prototype/Scriptaculous?  At a very basic level, it probably comes down to personal preference, jQuery was easier for me to grok.  But what first got me hooked was its straightforward use of selectors to work on DOM elements.

jQuery selectors are a combination of CSS 1-3, XPath, plus some custom code to glue it together. Essentially, the best parts from both of these query languages were taken, combined, and used to create the final jQuery expression language. If you already know CSS (which most web developers do) then you’re going to be fine.