24 Apr 2013, 22:38

JQuery 2.0

Last week, the famous javascript library JQuery was released as 2.0 version :

  • 2.x branch no longer supports IE 6/7/8 ; for those browsers, you should use the 1.9+ branch.
  • Reduced size (by 12%) due to the discontinuation of the IE6/7/8 support, with a related performance increase.
  • You can create your custom builds of JQuery containing only the JQuery parts you need
  • API of the 2.0 and 1.9 versions should be the same so migration should be easy. However, it is strongly recommended to read the upgrade guide to 1.9 and to use the JQuery Migrate plugin to track/identify the code you need to update (if you come from a pre 1.9 version of JQuery and to make it 1.9+ compatible)
  • The coming development effort will be both on the 2.x and 1.x branches aiming to provide the same set of features (modulo the browser compatiblity) ; 2.1 should be compatible with 1.10, and so on. However, release date for both versions may differ as each branch has its own dev team.

You may also be interested by the JQuery.noConflict() which allows you to load different versions of JQuery without interferences if your code or plugins require it.

Also as a reminder, if you use the CDN version of JQuery, be sure to stick to a specific version and not call always the latest version if you want your site/app running well :

# Will load the 1.9.0 version of JQuery and only this version even if the 1.9.1 or 1.10 version is released; recommended version
ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js

# Will load the 1.9.x version of JQuery - So when 1.9.1 is released, you will automatically get it - May be safe enough as long as patchs does not break compatibility.
ajax.googleapis.com/ajax/libs/jquery/1.9/jquery.min.js

# To avoid definitely, as when 1.10 is out, your site will use the 1.10 version ; it may hurt your site significantly.
ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

# Same as above
http://code.jquery.com/jquery-latest.min.js

[Edit 31/10/14]

A little more than one year later, JQuery 3.0 is announced :

  • Next version after JQuery 2.1.1 will be JQuery 3.0
  • JQuery 3.0 (former 2.x branch) will support n and n-1 versions of the browsers ; which would probably mean that it would drop IE9 too.
  • JQuery 3.0-compat (formet 1.x branch) will support older versions of browsers