The jQuery team has just released new versions of both branches of jQuery. While they bring bug fixes and support for more web environments there are no changes to the APIs.
This final release is feature compatible with the beta, which we reported on in September 2013, so code should just run faster without requiring devs to make changes to their existing code.
Since the release of jQuery 2.0 there have been two versions of jQuery. Those on the 2.x branch are smaller and faster but don't support older browsers - specifically they don't support Internet Explorer before IE9 while the 1.x.x branch is continuing to accommodate IE6, 7, and 8. Now with 2.1.0, the 2.x branch adds support for non-traditional web environments like node.js and browser plugins for Chrome and Firefox.
Announcing the releases on the jQuery blog Dave Methvin says: “We’ve fixed quite a few bugs, but the other features and changes are mainly organizational ones that don’t affect the behavior of APIs. Your code shouldn’t break, it should just run a little faster.”
He also reminds devs that jQuery had major changes in the 1.9 release and that there's a jQuery Migrate plugin to help those upgrading from earlier versions.
Among the changes from the earlier releases (as opposed to the beta), the new versions have fewer forced layouts. Dave Methvin explains:
“In this release we declared war on places where we might inadvertently force the browser to do a time-consuming layout. We found a few and eliminated one in particular that could occur when changing class names. This can result in a big performance boost for some pages.”
If you’re writing an app where space is limited, you can now make use of granular custom builds, choosing specific small subsets of the library. You can find out more details in the jQuery Readme file on GitHub.
The new versions also have a lower overhead at startup. The team has refactored the feature detects so that they run the first time they’re needed. If you never call the API needing that feature detect, you never run that code. This should be of particular benefit on mobile platforms.
The new versions are published on npm and Bower. The npm publishing means you can use them with node or browserify, though only the 2.x branch is supported to run in node.
One element you won’t find in this release is the sourcemap comment in the minified file. The team says sourcemaps have proven to be a very problematic and puzzling thing to developers. Sourcemaps will still be generated and distributed, but if you want to see them you’ll need to add the appropriate sourcemap comment at the end of the minified file. The blog post says the team hopes to bring back and improve sourcemap support in the future.