As you may have already known, the amazing people at jquery.com have come out with a new major release of the jQuery javascript toolkit. The jQuery is now at version 2.0. But you may also have noted that they are also actively maintaining version 1.9. This post will try to clarify why the developers are maintaining two versions of this ever popular toolkit as well as which version you should be using in your website / app.

 

jQuery
jQuery Javascript Library

Cleanup

The jQuery library underwent a massive cleanup in it’s code base in order to remove insecure, inefficient, ineffective, and inadvisable features. As a result, the library is orders of magnitude lighter and additional features have been added to make use of the more efficient CSS3 and HTML5 features. But a downfall of all this cleanup is that, the developers were forced to drop support for older Internet Explorer versions 6,7 and 8 (known collectively as oldIE) in order to use the latest features in the HTML5 and CSS3 specifications. As we all know, Internet Explorer is a little backward in terms of support for the latest standards and has been a thorn in the side of developers the world over for many years now.

Left in the lurch?

An important fact that is to be remembered here is that the oldIE browsers represent almost one third of the entire internet users. So will developers that are hoping to still cater to these users be left in the lurch? Of course not. The jQuery developers decided it was best to split the use of the toolkit into two separate versions: 1.9 and 2.0. From the jQuery blog, we can gather the following:

  • jQuery 1.9 (early 2013): We’ll remove many of the interfaces already deprecated in version 1.8;  some of them will be available as plugins or alternative APIs supported by the jQuery project. IE 6/7/8 will be supported as today.
  • jQuery 1.9.x (ongoing in 2013 and beyond): This version will continue to get fixes for any regressions, new browser bugs, etc.
  • jQuery 2.0 (early 2013, not long after 1.9): This version will support the same APIs as jQuery 1.9 does, but removes support for IE 6/7/8 oddities such as borked event model, IE7 “attroperties”, HTML5 shims, etc.

To summarize, version 1.9 will still be maintained as a separate bugfix version that supports the oldIE browsers and will be API compatible with the newer version. Version 2.0 will not support oldIE and will showcase the latest in efficient and secure browser features and will be smaller in size when compared to version 1.9.

Should I use version 2.0?

One of the major goals of the developers of the jQuery library was to make 2.0 and 1.9 interchangeable in order to make the transition from 1.x series to the newer 2.x series as smooth as possible. In effect, your decision to choose one over the other should be based on this simple statement: If you need IE 6/7/8 support, choose 1.9; otherwise you can use either 1.9 or 2.0.

Even better, if you are so aligned, you can use conditional statements to load version 1.9 for oldIE browsers and 2.0 for later browsers as shown in the code snippet below:

<!--[if lt IE 9]>
<script src="jquery-1.9.0.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="jquery-2.0.0.js"><</script>
<!--<![endif]-->

So, if you are in the lucky minority and do not have to cater to users of oldIE browsers, you can take advantage of the new jQuery 2.0 browser and all its latest features and efficiency.

jQuery 2.0 and 1.9 – What it means for you as a developer

One thought on “jQuery 2.0 and 1.9 – What it means for you as a developer

  • April 10, 2015 at 4:36 pm
    Permalink

    Thanks for sharing this Information blog. Recently I have completed Oracle Training Courses in Bangalore at a leading Company. It’s really useful for me to make a bright Future career.
    Visit Us, Oracle Training in Bangalore

    Reply

Your Thoughts: