May 5, 2011
doesn't jQuery support *insert feature* natively?"
Posted in "thoughts"
Let me preface this blog post with the fact that I'm not on the jQuery Core team but have been helping out the project on the Design sub team (I get to make the website look nice and make updates to it). Either way, I think that I have a good grasp on this question, and it's answer, now after being asked it, and asking it myself, many a time.
Just today my buddy Ryan Olson (@ryanolson) responded to a tweet where the receiver had asked why he needed to include jQuery UI or the Color Plugin to have color animations work with
.animate(). This is a fairly reasonable thing to ask, of course, along the lines of "Why doesn't jQuery support float animations?" or "Why doesn't jQuery support height / width auto animations?". All of which I've answered with plugins on my blog here, although the question as to why they aren't native still stands.
So, why isn't X feature in jQuery?
The popularity of jQuery wasn't by accident. Because of it's semantic coding conventions and lean size people flocked to use it. A great example of how the library has grown can be found over on Mathias Bynens' (@mathias) website, where he's mapped the file size per major release: http://mathiasbynens.be/demo/jquery-size
Looking at the graph, the green line is the most important here, you can see that the growth of the actual codebase has only slightly moved north. Including unnecessary features would open the flood gates to requests for anything to be thrown into core and thats no good for the library.
Core has, and will, always stay "lean". Library's like jQuery UI and jQuery Mobile have come from the fact that bloating the Core for specific needs wasn't a smart move. jQuery is extensible through plugins so that it doesn't have to be a jack of all trades. In many cases the arguments above about
.animate() not supporting color and relative positions are left to a very small few use cases. And, although it's not nicely packed into the core, there are plugins (like John Reisg's and mine) that enable this functionality.
So to conclude
I understand that you think it a reasonable "ask" to have a few of these things baked in. And by all means I'm not deterring anyone from posing those questions to the team. In fact, I encourage it. Right now the jQuery team is looking for new ideas to bake into the 1.7 release so start throwing ideas out (jQuery 1.7 Roadmap Proposal Form). Be encouraged to contribute and to "Get Involved". The community appreciates it and you'll have a far better grasp of the decision making when you start to get your hands dirty.
That said, I advice everyone who does submit a proposal to try and build out their idea first as a plugin. Do some tests and really think about whether or not the feature should live within the core.
Until 1.7, Keep your stick on the ice!