Sizzle Power in MooTools?
There’s a lovely post on Ajaxian today that the Dojo community is now voting on whether or not to swap out their own selector engine for Sizzle, Jon Resig’s CSS selector engine. Several other frameworks are considering doing the same thing. jQuery is using it already of course, but Prototype, MochiKit and others are all looking into it.
One the one hand, it kind of makes sense for frameworks to work together for these types of things. Why invent the same wheel over and over again? What about event management? Garbage collection? Why not consolidate a lot of this stuff?
So, as I see it, here are the pros and cons of swapping out the MooTools’ selector engine for Sizzle.
- MooTools benefits from development contributed by all the other framework authors. Someone on the Dojo team figures out how to do something faster, and whammo, MooTools gets it, too. The obverse is true as well – MooTools can contribute to the speed and stability of other frameworks in the same way.
- It means fewer bugs that the MooTools developers have to squash. When new browsers show up that introduce new capabilities, core the developers don’t have to drop everything to rework things.
- It sets a precedent for the notion that the framework teams out there (including the MooTools team) don’t have to write everything themselves. Let’s focus on what makes our frameworks different and delegate the things that make them similar.
- It makes it easier to move from one framework to another. Custom selectors and the like are available to all frameworks.
- More clout can be had with the browser vendors if all the frameworks are using the same standard.
- It would show that the frameworks can actually agree on something for a change and that this isn’t a competition.
- CSS selectors are, by and large, all about as fast as the next now. There’s not much benefit to be had as far as speed is concerned.
- Sizzle caches selector results, which we could add to MooTools if we liked and we might, but perhaps this isn’t something everyone wants.
The MooTools coding philosophy is definitely set on having extensible code. Anyone can author custom selectors for the MooTools selector engine and the code in the engine is very clean and understandable to any MooTools user. We’d loose some of this if we moved to Sizzle.I have since been corrected here: Sizzle is very extensible.
- There’s something to be said about autonomy. By having its own selector engine, MooTools can add functionality and manage its own needs.
- While adding Sizzle might be a nice gesture to the community, illustrating that we can all get along together, it may not offer any other big benefits (if you don’t consider any of the Pros above big benefits).
Are there other pros and cons I haven’t thought of? I feel like I’m missing something, I dunno.
What are your thoughts as a MooTools user (if you are one)? Does this even matter to you? Do you have a preference? Would it make you happy to see MooTools adopt this standard bit of code or would you rather see MooTools maintain its own query engine?