Migrating Earilier Versions of jQuery to jQuery 1.9

Sam Deering

ALOT of old functionality has (1.9.x) and will be (2.x) removed from the jQuery Library, with the latter removing support for oldIE. Looking forward in 2013 on how jQuery will support IE is quite a debate. Plugins using functions which no longer exist may break and start producing errors. You may start to see errors appearing if you’ve used the latest build to include jQuery in the past (see below) as this just pulls the latest version.

//jQuery API
<script src="http://code.jquery.com/jquery-latest.js"></script>

//Google API
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Errors might start appearing because some functions have been deprecated in jQuery 1.9.1 and removed from the API, ie they no longer exist. Previously popular cuprits such as $.browser() and $.live() have been removed completely and referencing them will break your code when used with later versions of jQuery. The quick solution is to use jQuery Migrate Plugin which updates the API of jQuery adding fixes to jQuery 1.9 migration errors.

So you might include it like this:

<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>

jQuery 1.9 Upgrade Guide

Also note that the unminified source versions add console.log/warnings which detail removed API function references and other warnings in an array stored on jQuery.migrateWarnings. Pretty useful if you want to update your jQuery plugins to support jQuery 1.9.x out of the box. I hope the decision to drop oldIE support doesn’t break too many websites… I guess only time will tell…

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.