jQuery 2.0 Released

Posted on by

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:

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

Attributes

Build

Core

Css

Deferred

Effects

Event

Manipulation

Selector

Support

Traversing

Please do not report bugs in the blog comments! Instead, read the blog post for details on how to report bugs.

169 thoughts on “jQuery 2.0 Released

  1. Hi guys,
    I’m trying to use jQuery 2.0.0 in my Windows 8 store app. The app works fine, but I get the following error when I run the app validation kit, which is required in order to publish an app to the store.

    FAILED
    Bytecode generation
    Error Found: The bytecode generation test detected the following errors:
    File \\?\C:\Program Files\WindowsApps\25899MatthewKaufer.TrigonometricTriangleSolver_1.0.0.4_neutral__2hr1s851qz6de\js\jquery-2.0.0.js has JavaScript syntax or other problems.
    Impact if not fixed: As a performance optimization to accelerate JavaScript execution time, JavaScript files ending in the “.js” extension generate bytecode when the app is deployed. This optimization significantly improves start-up and ongoing execution times for JavaScript.
    How to fix: You may need consider one or more of these steps to fix the issue:
    – Ensure that event logging is enabled
    – All JavaScript files are syntactically valid; otherwise exclude the respective files from the package
    – Please note that you should uninstall all previous versions of the app before deploying
    Otherwise exclude the respective files from the package.

    Basically, it doesn’t like the code for some reason or another. Does anyone here have a fix for that?

  2. Joshua Holden on said:

    I too think this was a bit too soon. Yes you always need to be moving forward and us developers would love to use the latest and greatest as soon as possible but IE8 still holds a large chunk of the market share. You cannot expect that developers start building apps on a platform a company cannot use / support. It’s a slow process to change standards in any large company and for many good reasons.

  3. Fernando on said:

    I am happy to see the jQuery team is looking forward and has decided to use jquery’s well deserved influence to push development to take advantage of the new browsers capabilities. I am sure reducing the size of the framework is not the main reason for this decision. More over, support for IE on version 1.x will continue so let’s all look ahead and make de web better. Congratulations!!!!!

  4. Hello

    I have a problem with this ” You can now exclude combinations of 12 different modules to create a custom version that is even smaller.”

    Why would you do that ? Maybe the client will include a small version of jquery and your plugin requires a module not included. How can you explain him that he needs that specific module and to change the jquery version if he is noob ?

    I vote for full jquery every time.

  5. I don’t fully get how it would make sense to stop supporting 25% of users for 15% in size reduction, with no added benefits.

    I’m sure I’m missing something. Can somebody illuminate me?

    Thanks!

  6. Carl White on said:

    Essentially over the years code is added to support/hack/circumvent issues in older deprecated browsers which can be removed which reduces size and improves performance.

    They do say to continue using the ‘API compatible’ 1.9.x library for websites that *require* support for these older browsers, but some frameworks for app development etc, do not require this so the v2.0.0 framework is smaller, lighter and faster. Hope this helps.

  7. How are people not understanding this?

    There are a ton of environments where you will never run into IE8-, such as the ones listed in the article:
    Windows 8 apps
    Chrome OS apps
    Firefox OS apps

    So why use a jQuery version that supports these browsers in these environments. 2.0 is moreso built for these situations and for web apps that the developers have decided not to support these browsers anyway. If you need to support IE6/7/8, then stop complaining about 2.0 being released and keep using 1.x.

    Also, for those complaining about the build process where you can strip out modules: this is not for your clients’ websites. This is for sites that you completely control and maintain. Of course you don’t give a stripped-down jQuery to someone who doesn’t know what they’re doing but will still add plugins that depend on jQuery. But people like you aren’t the only web developers in the world.

  8. Breno on said:

    +1 Joe Zimmerman! The negative commentors seem to be missing the point entirely. uoting the second sentence of this blog post by dmethvin:

    “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.”

    So clearly it is not just about a smaller file size. In my particular projects, running faster and leaner code, and cutting out the old browser quirks are the main headliners for me. Who cares about library file size when it’s primed in the cache from a CDN haha.

    If you have even the slightest requirement to support older IE browsers, stick with 1.X. Simple!

  9. This is ridiculous. The primary reason for the success of JQuery is cross platform scripting, and for apparent religious reasons the team just dropped support for a large market share of browsers.

    JQuery 2.0 should have been forked to JQuery Compact or some other branch if there is such a need for it. By calling it the “latest” version, it causes major headaches for those who require “true” cross platform scripting – ie. ALL commercial websites exposed to the general public.. For instance I can no longer use Nuget to acquire the aforementioned new versions of the 1.x branch, because it is going to want to install 2.x now.

  10. I just want to echo what a few other individuals have stated. If the next web stats are correct, you just stopped supporting the #1 browser in use today (IE8) with your latest version of Jquery. I understand the difference, I understand we can all use two different versions of jquery… however it doesn’t make me excited to think that my web sites/apps will now have to take differences in code base into consideration, possibly losing that 12-15% gain you talk about. #Justsayin… bad move imho… definitely a few years too early.

  11. This is fantastic. Now, I can serve the smaller jQuery to the browsers that support it, and only serve the larger payload to older versions of IE. The better browsers get better performance.

    This is really fantastic! :)

  12. Michael on said:

    I for one applaud the jquery team this work. I am moving my entire corporation off IE. This is perfect for us.

    Honestly people, what are you complaining about? its not that complicated…

    support <= IE8 ? jquery 1.x : jquery 2.x

  13. Finally the market are leaving IE 6/7/8, but unfortunately i cannot use this jQuery version in all my projects because in some of my projects my target users still using IE8.

  14. We thought, JQuery was build for cross browser development. Don’t see any reason why the team is deviating from their core objective. Still, a maximum number of websites run on IE 8 and taking off support for these browsers may not be a good idea. Its just an opinion.

  15. Steven on said:

    I’m appalled at how ridiculous all these negative comments are. jQuery 2.0 is a fork for environments that inherently are IE-compatible. jQuery 1.x will continue to be supported, developed, and improved for traditional web development, while jQuery 2.0 is immensely beneficial for app environments.

  16. Thank you for all this, It has finally started. I am sure it won’t be a rapid transition, but it gives us solid hope that IE 6/7/8 and the related misery can be buried forever.