Get Ready To Load Different Versions Of jQuery
If you have done any sort of front-web development the you will understand the benefits that jQuery can bring you when developing your websites. One of the best benefits of jQuery is that it performs the same on all browsers, so anything you do in the latest version of chrome will act the same in IE.
This is a massive benefit when working with jQuery animation, as you know whatever you do with jQuery will work on the other browsers. Even working with JSON or XML jQuery makes it very easy to work in the different browsers.
Recently on the jQuery blog they announced that from version 2 of jQuery they will not be support IE8 or lower.
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.
The plan is to make jQuery 1.9 and jQuery 2.0 very similar except to remove all support for IE6-IE8 in version 2.0. If you have ever looked at the jQuery source you would notice that there is lots of code in there to deal with IE6-IE8, therefore removing this support is going to have a big impact on the size of the jQuery.js file.
Having a smaller size file means that jQuery performance on version 2.0 will be much faster than on version 1.9. jQuery has also mentioned that removing support for the IE browsers will mean that error handling in the jQuery code will be improved.
Version 2.0 of jQuery isn't expected to be released until 2013 so you have some time to prepare for the upgrade.
What To Do If Your Site Still Has IE Visitors
If your site in 2013 still gets lots of visitors from IE6-IE8 then you will not be able to upgrade your jQuery version anymore, but this doesn't mean that visitors using up to date browsers can't have the benefits of using the latest version of jQuery.
The best way to import jQuery on your still if you still have IE6-IE8 visitors is to use conditional IF statements.
In your head tag where you import jQuery you will need to replace it with this.
<!--[if lt IE 9]> <script src="jquery-1.9.0.js"></script> <![endif]--> <!--[if (gte IE 9) | (!IE)]><!--> <script src="jquery-2.0.0.js"></script> <!--<![endif]-->
This code will load the version 1.9 for anyone using IE6-IE8 but anyone using up to date browser will load jQuery version 2. This way you will not have to import both versions and newer browser will not have to load the larger 1.9 version file.
This doesn't mean that jQuery will stop support version 1.9 they have said they intend to continue to add new APIs to version 1.9 at the same time they develop new APIs for version 2.
Learn how to code with Treehouse
- Learn projects with access to 1000+ videos
- Practice live with our Code Challenge Engine
- Get help in our members-only forums
Join the weekly newsletter
Sign up for our newsletter. You'll be updated on new tutorials as they come available.
Subscribe today and get a 50% discount code to Paulund