jQuery 2.0 Released
You asked for it, you got it: jQuery 2.0 has arrived!
As promised, this version leaves behind the older Internet Explorer 6, 7, and 8 browsers. In return it is smaller, faster, and can be used in JavaScript environments where the code needed for old-IE compatibility often causes problems of its own. But don’t worry, the jQuery team still supports the 1.x branch which does run on IE 6/7/8. You can (and should) continue to use jQuery 1.9 (and the upcoming 1.10) on web sites that need to accommodate older browsers.
Where to Get It
The final jQuery 2.0.0 files can be found here on the jQuery CDN:
- http://code.jquery.com/jquery-2.0.0.min.js (minified, for production)
- http://code.jquery.com/jquery-2.0.0.js (unminified, for testing)
The files should also be available on the Google and Microsoft CDNs soon, but please give these folks a few days before releasing a storm of impatient tweets. Also remember that production web sites should be requesting a specific version from any CDN; using a non-specific version like /2/
or jquery-latest.js
is considered harmful to your web site’s health and performance.
If you’re upgrading from a version before 1.9, we recommend that you use the jQuery Migrate plugin and read the jQuery 1.9 Upgrade Guide, since there have been a lot of changes. It’s easy to use the plugin, just include it in your HTML file after jQuery and open your browser console to see the messages it generates:
<script src="http://code.jquery.com/jquery-2.0.0.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>
How to Use It
jQuery 2.0 is intended for the modern web; we’ve got jQuery 1.x to handle older browsers and fully expect to support it for several more years. If you want, you can serve 2.0 to newer browsers and 1.9 to older ones using our conditional comment trick, but that is not required. The simplest way to support older browsers is to use jQuery 1.x on your site, since it works for all browsers.
With the release of jQuery 2.0, there are a few environments where the jQuery team will no longer support use of the 1.x line because 2.x is a far better choice. These are typically non-web-site scenarios where support for older IE isn’t relevant. They include:
- Google Chrome add-ons
- Mozilla XUL apps and Firefox extensions
- Firefox OS apps
- Chrome OS apps
- Windows 8 Store (“Modern/Metro UI”) apps
- BlackBerry 10 WebWorks apps
- PhoneGap/Cordova apps
- Apple UIWebView class
- Microsoft WebBrowser control
- node.js (combined with jsdom or similar)
Many of these environments are themselves a work in progress, and have unique sets of rules or restrictions that are different from the ones typically found when jQuery is used for browsers on Internet web sites. Although we aren’t able to test regularly in all of these non-browser scenarios, we’d like to hear about your experiences in using jQuery with them. Even better, we’d love for the communities supporting these environments to pool and share their knowledge about how to use jQuery 2.0 there.
How 2.0 Changed
Here are some highlights of the changes that jQuery 2.0 brings:
No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart.
Reduced size: The final 2.0.0 file is 12 percent smaller than the 1.9.1 file, thanks to the elimination of patches that were only needed for IE 6, 7, and 8. We had hoped to remove even more code and increase performance, but older Android/WebKit 2.x browsers are now the weakest link. We’re carefully watching Android 2.x market share to determine when we can cross it off the support list, and don’t expect it to take very long.
Custom builds for even smaller files: This feature has been greatly refined and extended since its debut in jQuery 1.8. You can now exclude combinations of 12 different modules to create a custom version that is even smaller. A new minimal selector engine, basically a thin wrapper around the browser’s querySelectorAll
API, lets you shrink the build to less than 10KB when minified and gzipped. See the README for instructions on how to create a custom build, and remember that any plugins you use will also need to stick to the subset you select.
jQuery 1.9 API equivalence: jQuery 2.0 is API-compatible with 1.9, which means that all of the changes documented in the jQuery 1.9 Upgrade Guide have been applied to jQuery 2.0 as well. If you haven’t yet upgraded to jQuery 1.9, you may want to try that first. Be sure to use the jQuery Migrate plugin.
The full record of changes can be found in the changelog below, and in the list of commits on GitHub.
What’s Next
In keeping with our pledge to minimize API divergence between the 1.x and 2.x branches, we’ll be releasing a jQuery 1.10 within a couple of months that incorporates the bug fixes and differences reported from both the 1.9 and 2.0 beta cycles. In the future, we will be maintaining feature parity between 1.10 and 2.0, 1.11 and 2.1, etc. Patch releases will happen in each branch on their own schedule, based on team resources and severity of any reported bugs.
Please do try this new release with all your web sites and HTML apps. If you find problems, create a minimal test case (preferably using a site like jsFiddle or jsbin) and submit it to our bug tracker. We’re particularly interested in situations where jQuery 1.9.1 behaves differently than jQuery 2.0.0, since that’s something we’ve tried to avoid.
Who Helped
jQuery 2.0 has been 10 months in the making, a product of the jQuery Core team: Julian Aubourg, Corey Frang, Oleg Gaidarenko, Richard Gibson, Michal Golebiowski, Mike Sherov, Rick Waldron, and Timmy Willison. Oleg and Michal joined the team during the 2.0 odyssey; we’re glad to have them aboard.
Many thanks to the other jQuery team and community members who contributed fixes: Steven Benner, Pascal Borreli, Jean Boussier, James Burke, Adam Coulombe, Tom Fuertes, Scott González, Dmitry Gusev, Daniel Herman, Nguyen Phuc Lam, Andrew Plummer, Mark Raddatz, Jonathan Sampson, Renato Oliveira dos Santos, Ryunosuke Sato, Isaac Schlueter, Karl Sieburg, Danil Somsikov, Timo Tijhof, and Li Xudong.
To those of you who tested the betas and reported bugs, we’re especially thankful for your help since it helped to make the release more solid and stable.
How You Can Help
Please, participate! Try the code (especially the betas), file good bug reports with clear test cases, contribute patches. Write or edit documentation. Come to the jQuery Conference Portland in June and mingle with other jQuery-ites. Visit contribute.jquery.org to learn how to get involved with the project.
You can also become a jQuery Foundation member to support our efforts and get some fabulous gifts in the process!
jQuery 2.0.0 Changelog
Ajax
- #12838: domManip script evaluation implementations with alternate signatures
- #13276: In IE 9/10 $.parseXML() returning document object instead of XMLDOMDocument
- #13292: $.ajax with 1.9.0 doesn’t call anymore success function in case of 204
- #13306: File input added to serialized forms caused a change in behavior and only halfway follows spec
- #13388: Ajax request not returning responseXML
Attributes
Build
- #12656: Make event shorthands an excludable module
- #13316: Check against jquery.min.js with TestSwarm
- #13335: “use strict”; break asp.net ajax postacks in FF
- #13741: Make wrap*/unwrap methods an optional module
- #13744: Move jQuery.fn.size() to deprecated
- #13755: Update .jshintrc to match style guide
- #13759: Better undefined gzip compression
- #13760: getComputedStyle no longer works in node with jsdom
- #13776: License comment is breaking the SourceMap
Core
Css
Deferred
Effects
- #12846: overflow:hidden is not removed when .stop() is called
- #13183: Wrong animation initial value calculation (1.9.0rc1)
- #13483: Issue with stop(true).slideDown() during slideUp()
Event
- #13360: Creating String.prototype.namespace can cause an exception in jQuery.Event
- #11570: Move element cache to the element[expando] to avoid cleanup and reduce code.
- #13143: e.target can be a text node on mousewheel
- #13554: Move [un]bind & [un]delegate to event-alias
Manipulation
- #13232: In 2.0beta1, using html() function on a tbody selector yields insertion of new tbody
- #13233: Unexpected behavior when iterating over and manipulating detached nodes in jquery 1.9
- #13282: QtWebKit — TypeError: ‘[object Object]’ is not a valid argument for ‘Function.prototype.apply’ (evaluating ‘elem.nodeType’)
- #13596: .replaceWith should always remove the context set
- #13721: remove(“:nth-child(1)”) works differently than filter(“:nth-child(1)”).remove()
- #13722: .replaceWith argument handling is inconsistent with other manipulation methods
- #13779: .remove() changed in beta3 – now remove nodes in reverse doc order
Selector
- #13434: Create querySelectorAll/matchesSelector selector option
- #13331: jQuery.fn.add returns incorrect order in Chrome and Safari
- #13378: ie8 & ie9 iframe – .filter(“:focus”) – document.activeElement returns unspecified error.
- #13420: jQuery 1.9.1 fails to filter SVG parent nodes by class name when using .parent() and .closest()
- #13499: Descendant selector fails when searched ID doesn’t exists but NAME does (IE7 only)
- #13505: jquery#add: seems to get items in collection out of order on larger lists
Support
- #10814: make support as lazy as possible with closure in mind
- #12040: Test against Content Security Policy (CSP)
- #13089: support adds zoom style to body in Chrome/Safari
- #13743: Remove jQuery.support.boxModel
Traversing
Ajax
- #12838: domManip script evaluation implementations with alternate signatures
- #13276: In IE 9/10 $.parseXML() returning document object instead of XMLDOMDocument
- #13292: $.ajax with 1.9.0 doesn’t call anymore success function in case of 204
- #13306: File input added to serialized forms caused a change in behavior and only halfway follows spec
- #13388: Ajax request not returning responseXML
Attributes
Build
- #12656: Make event shorthands an excludable module
- #13316: Check against jquery.min.js with TestSwarm
- #13335: “use strict”; break asp.net ajax postacks in FF
- #13741: Make wrap*/unwrap methods an optional module
- #13744: Move jQuery.fn.size() to deprecated
- #13755: Update .jshintrc to match style guide
- #13759: Better undefined gzip compression
- #13760: getComputedStyle no longer works in node with jsdom
- #13776: License comment is breaking the SourceMap
Core
Css
Deferred
Effects
- #12846: overflow:hidden is not removed when .stop() is called
- #13183: Wrong animation initial value calculation (1.9.0rc1)
- #13483: Issue with stop(true).slideDown() during slideUp()
Event
- #13360: Creating String.prototype.namespace can cause an exception in jQuery.Event
- #11570: Move element cache to the element[expando] to avoid cleanup and reduce code.
- #13143: e.target can be a text node on mousewheel
- #13554: Move [un]bind & [un]delegate to event-alias
Manipulation
- #13232: In 2.0beta1, using html() function on a tbody selector yields insertion of new tbody
- #13233: Unexpected behavior when iterating over and manipulating detached nodes in jquery 1.9
- #13282: QtWebKit — TypeError: ‘[object Object]’ is not a valid argument for ‘Function.prototype.apply’ (evaluating ‘elem.nodeType’)
- #13596: .replaceWith should always remove the context set
- #13721: remove(“:nth-child(1)”) works differently than filter(“:nth-child(1)”).remove()
- #13722: .replaceWith argument handling is inconsistent with other manipulation methods
- #13779: .remove() changed in beta3 – now remove nodes in reverse doc order
Selector
- #13434: Create querySelectorAll/matchesSelector selector option
- #13331: jQuery.fn.add returns incorrect order in Chrome and Safari
- #13378: ie8 & ie9 iframe – .filter(“:focus”) – document.activeElement returns unspecified error.
- #13420: jQuery 1.9.1 fails to filter SVG parent nodes by class name when using .parent() and .closest()
- #13499: Descendant selector fails when searched ID doesn’t exists but NAME does (IE7 only)
- #13505: jquery#add: seems to get items in collection out of order on larger lists
Support
- #10814: make support as lazy as possible with closure in mind
- #12040: Test against Content Security Policy (CSP)
- #13089: support adds zoom style to body in Chrome/Safari
- #13743: Remove jQuery.support.boxModel
Traversing
Please do not report bugs in the blog comments! Instead, read the blog post for details on how to report bugs.
Congratulations, you all rocks!! Thanks for dump away IE, and let’s play!!
Is there any particular reason that sizzle is included in the main production build? If IE<9 is not supported, what's the need for sizzle? What am I missing?
Thank you, guys!
Wow… thank you guys!
Thank you guys, great job. I’ll share this information to all my friend.
Awesome things happen!
Great. I will start using in my work.
Thank you for your great work!
This is great news, Amazing work guys! Congratulations! It’s a big step to move the web forward.
@Yoav – my understanding is that the Sizzle selector engine has a few selectors above and beyond the CSS3 Selectors.
@Yoav You’ll find reasons in a comment at the beginning of this file:
https://github.com/jquery/jquery/blob/master/src/selector-native.js
thanks all developers
Very exciting! Good work.
I have a dream, a dream that i could focus a majority of my energy on creating great experiences for users. Instead of spending it figuring out how to make something work ‘good enough in ie’. Thanks for dropping old ie support and nudging the world in a better direction.
Could you make a visual representation of “the weakest link”, or the software you have to support, that you feel holds your code base back, makes it bloated, ect.
1 step closer to IE8 oblivion. GJ
it cool to know that you did the right job what IE deserve. I wish i could kiss the ass of IE when i am writing css for sites.
Thank you for this amazing library !
And leave of IE is also the better step.
<3 jQuery !
I am glad that disabled ie, thank you guys!
Apparently, there is not a compatible library for this. Unfortunately, this is the default ASP.NET MVC template that uses the Microsoft library so we can’t upgrade to 2.x until that is resolved.
Unable to find a version of ‘Microsoft.jQuery.Unobtrusive.Ajax’ that is compatible with ‘jQuery 2.0.0’.
I know this is Microsoft’s problem, but I’m just posting here for awareness.
Awesome news! You guys really help the web to move forward…. and fast. Thanks!
Yeahhh!! Thank you for dumping support for IE8.
Great job guys!
good news.
best of luck for future………
:)
Good achievement, appreciated your efforts
Thank YOU!!
Awesome news, congratulations guys.
Wonderful. Thanks for dropping IEs. Let us build future web.
@Chris
you should be able to use the jQuery migrate plugin to replace the legacy APIs that asp.net MVC uses.
BOb
Thank man!!!!!!
While I applaud the new features, I’m not sure how relevant this release is if you can’t even guarantee compatibility with ie 9. Realistically speaking, this is pretty much DOA for me :/
G8 job!
Good news :) thanks a lot :)
Awesome work you guys!
Well done guys. Hurrahhhhhhhhhhhhhh!
Thanks for Dropping IE !
Thanks guys! This is awesome!
Awesome news guys, really looking forward to completely dropping support for IE6/7/8 – onwards and upwards :D
nicely done!
Great Job. Looking forward to seeing some benchmark posts.
Can’t wait to hear the complaints from coworkers about web pages not working in IE.
Very good jobs guys !!! Love to try it as soon as possible !
thank you all developer
awesome work guys.. cheers!!
The best would be dropping support for all closed source browsers.
Thanks for dropping old IE support!
Thank you guys!!
In the name of many (many) developer out there that will enjoy the fruits of your hard work!!
Excellent. I am an IE user generally but as a dev look forward to dropping older browsers. We stopped supporting IE6/7 for a while. Still… I am a little concerned because I think that the average user doesn’t understand compatibility mode … and I can see a lot of tech support calls related to users simply having compatibility on even if not necessary.
Tanks very much, but I think we should jQuery 1.9 for 10 years in future!! :)
Awesome news..
One thing you might want to keep an eye on is your Nuget package. I think most Visual Studio users have switched over to using it to grab query, and with an active 1.9.x and 2.x branch there may be issues.
Reading, it sounds like you guys are recommending people stick with 1.9.x until they’ve really tested, so maybe 2.x is a new package?
Related question I asked on StackOverflow: http://stackoverflow.com/q/16125828/11912