3 ms·
the jQuery project has started doing this[1]. It was at risk of ending up like PHP (in more ways than one). the core team recognizes that the API needs a trim.
by nikcub 15y ago
the jQuery project has started doing this[1].
It was at risk of ending up like PHP (in more ways than one). the core team recognizes that the API needs a trim. I also no longer use jQuery and haven't in a while because of the bloat.
but I think the way they are approaching it is wrong. They want to trim the API by 10% for the next -1.8- (edit: 1.7) release. This would break semantic versioning[2].
I think they should fork the code now with a new 'jQuery 2' branch and not break any backwards compatibility in the 1.x branch. The 2.x branch should be a complete re-org with browser support as modules (for eg. if you want to support IE 6.0 you enable a module, etc.)
For now, the jQuery light branch should be optional in 1.x. There are analogies in this approach with what PHP did between 4 and 5, and what Python did between 2 and 3. jQuery shouldn't be stripping out API functions in point releases, but it definitely, definitely needs a trim (and I would rather this work is done on the mainline jQuery project rather than in forks. I think a lot of devs at the moment have forks of Zepto/jQuery they run (i do)).
this project may be the perfect starting point for a jQuery2 branch. i'd definitely be interested in working on that project, and bringing in features from all the various forks and cleaning it up.
[1] http://blog.jquery.com/2011/11/08/building-a-slimmer-jquery/ http://blog.jquery.com/2011/11/08/building-a-slimmer-jquery/
[2] http://semver.org/ http://semver.org/
Edit: the deprecated API functions are planned for v1.7, not v1.8 - which means soon. I think it will cause a mess for people who auto-upgrade.
- johnbender 15y agoThe most important deprecations are of live/die, though they won't be removed until 1.9. Use delegate as the replacement $("#foo").live("click", function(){ }); is equivalent to $(document).delegate( "#foo", "click", function() { });
- masklinn 15y ago> Use delegate as the replacement Actually, use the new `#on` as replacement: it can handle the job of `#bind` and `#delegate` (and `#live` of course), so I'd fully expect it to be the only one remaining in the fullness of time. Warning: the first two arguments are reversed compared to `#delegate`: $(document).delegate("#foo", "click", function() { }); becomes $(document).on("click", "#foo", function() { });
- funksta 15y agoThere's a nice article about transitioning to .on() and .off(), including the changes and benefits, at: http://www.andismith.com/blog/2011/11/on-and-off/ http://www.andismith.com/blog/2011/11/on-and-off/