No More Support for IE6/7/8
(or IE9 and IE10 if they’re used in “Compatibility View” mode).
I still think it’s a little premature to abandon IE8 but the team couldn’t wait any longer. jQuery 2.0 removes all the legacy IE code for node selection, DOM manipulation, event handling and Ajax.
This has resulted in a 11% file size reduction from 32,819 bytes to 29,123 bytes. That’s 3.6Kb for the gzipped minified version — it’s unlikely to be noticeable even on a dial-up connection. Admittedly, the team hoped to save more but discovered that Android/Webkit 2.x browsers still required many workarounds.
If you need to support IE8 and below, stick with jQuery 1.9.x for now. You could conditionally load version 2.0 in all other browsers, but:
- conditional loading will offset any gains in file size reduction and processing, and
- you may encounter differences between the two jQuery branches. The team has pledged to minimize API divergence but there will almost certainly be issues. jQuery 1.10 will address known compatibility problems.
The custom build feature has been refined in version 2.0 so you can exclude any of 12 unused modules and shrink jQuery below 10Kb. The modules which can be omitted are:
- ajax: all Ajax functionality, transports, and event shorthands.
- ajax/xhr: XMLHTTPRequest Ajax transport only.
<script>Ajax transport only.
- ajax/jsonp: JSONP Ajax transport only (depends on ajax/script).
- css: The
.css()method plus non-animated
- deprecated: deprecated methods (currently
- effects: the
.animate()method and its shorthands such as
- event-alias: event attaching/triggering shorthands such as
- offset: the
- wrap: the
- sizzle: the Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the native
querySelectorAllmethod which does not support some advanced jQuery selectors.
For example, if you are using CSS3 animations rather than jQuery methods, you could omit the effects module and possibly dimensions, offset, wrap and sizzle.
Creating your own custom build is not for the faint-hearted and you’ll require some knowledge of Git, Node.js and Grunt. Full instructions are available but, longer term, I hope the team can implement an online build process similar to Modernizr.
Should I Upgrade?
It’s important to understand that jQuery 2.0 has API parity with jQuery 1.9. There are a small number of bug fixes but no new features.
However, if you’re one of those lucky developers who has dropped support for IE6/7/8, grab jQuery 2.0 and don’t look back.
Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.
The Principles of Beautiful Web Design, 4th Edition
Docker for Web Developers
HTML5 Games: Novice to Ninja