Share

From this page you can share Sizzle to a social bookmarking site or email a link to the page.
Social WebE-mail
Enter multiple addresses on separate lines or separate them with commas.
Sizzle
(Your Name) has forwarded a page to you from Ajaxonomy
(Your Name) thought you would like to see this page from the Ajaxonomy web site.

Sizzle

Tagged:  

In August of 2008, John Resig started the Sizzle project, a new JavaScript CSS selector engine, with the goal of providing a small (about 4k) and fast core that could be leveraged by jQuery as well as other libraries (such as Dojo, MooTools, etc.). According to Resig, the new library is about 4 times faster than other selector engines in all major browsers. Resig has also been active in courting other framework designers, asking them to adopt Sizzle in their libraries.

While some have many have expressed great excitement at the idea of having a common selector engine, not all are enthusiastic about the idea. Valerio Proietti from the MooTools project has written a blog detailing why he won't be using Sizzle, and even going so far as to say it discourage competition in the JavaScript framework arena.

I’m not saying that John Resig seeks a monopoly over CSS selector engines, but that’s sure what it looks like. Competition and innovation will stop if everyone uses the same piece of code. Yes, competition and innovation[...]

So, if using one shared selector engine is ok, where do we draw the line? Is it ok to use a shared DOM manipulation library, or a shared event library? What makes our framework ours? If we start replacing core parts by outsourcing them to Dojo, our frameworks will just be a dull layer for code we didn’t even write, and we will lose credibility.

While one has to respect Valerio's decision to stick to his own code, I think that he misses some of the potential benefits of having a common selector core across multiple frameworks: elimination of code duplication, consistency of behavior, and robustness (if multiple libraries use a common core, bugs get squashed quicker). After over a decade, JavaScript is finally "growing up" as a language: frameworks like Dojo, Prototype, and jQuery have been a big part of this, allowing developers to get much more done in a much faster time frame than was possible before. It is only natural during this process that common pieces of infra-structure get built to allow framework designers to focus on other things.

If Resig does a great job with Sizzle, why should a new JavaScript library re-invent the wheel? Claiming Resig is somehow seeking a "monopoly" over JavaScript selector engines seems a bit silly and far-fetched. I think the real issue is an (understandable) pride is his own code, and a reluctance to throw it away in favor of someone else's...