If you are planning to move older jQuery code to version 1.9.0 or higher of jQuery then here is something that can greatly simplify your job.
On 4 February , 2013 the jQuery team announced that jQuery 1.9.1 is available(jQuery 1.9 was released about a month ago) . This version of jQuery core provides support for a full spectrum of browsers, from IE6 all the way to the most recent releases of every major browser. While a major thing to notice is that from version 2.0 and above jQuery is dropping support for old IE ( 6, 7 and 8.) and as a result it will be both faster and smaller than jQuery 1.9.
jQuery 1.9 removes or modifies several APIs that behaved inconsistently or inefficiently in the past.
Some of the methods that have been removed are:
.browser(),
.toggle(function,function,...) ( It should not be confused with the "change the visibility of an element" of .toggle() which is not deprecated. )
.live() etc
Why this jQuery Migrate Plugin?
On the official website of jQuery it has been mentioned that
"We realize that existing sites and plugins may be affected by these changes, and are providing the jQuery Migrate plugin for a transitional upgrade path."
This plugin can greatly simplify the process of moving older jQuery code to version 1.9.0 or higher of jQuery by identifying deprecated features.
This will help us find things that may cause upgrade issues when we move up from older jQuery versions, and to allow older code to work with either jQuery 1.9 or 2.0.
The jQuery Migrate plugin can be used with either 1.9 or 2.0 to detect deprecated and removed features, or to restore old features for those situations where we need old code to run with new jQuery.
How to use jQuery mIgrate in our code?
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>
API:
This plugin adds three properties to the jQuery object.
1.)jquery.migrateWarning
2.)jQuery.migrateMute
3.)jQuery.migrateTrace
jQuery.migrateWarning: This property is an array of string warning messages. These warning have been generated by the code on the page. There ordering in the array is same as in the order they were generated.
A point to remember is that messages appear in the array only once, even if the condition has occurred multiple times, unless jQuery.migrateReset() is called.
jQuery.migrateMute:n We set this property to true to prevent console warnings from being generated in the debugging version. Even though we set this property the jQuery.migrateWarnings array is still maintained, which allows programmatic inspection without console output.
jQuery.migrateTrace: we set this property to false if you want warnings but do not want traces to appear on the console.
jQuery.migrateReset(): This method clears the jQuery.migrateWarnings array.
On 4 February , 2013 the jQuery team announced that jQuery 1.9.1 is available(jQuery 1.9 was released about a month ago) . This version of jQuery core provides support for a full spectrum of browsers, from IE6 all the way to the most recent releases of every major browser. While a major thing to notice is that from version 2.0 and above jQuery is dropping support for old IE ( 6, 7 and 8.) and as a result it will be both faster and smaller than jQuery 1.9.
jQuery 1.9 removes or modifies several APIs that behaved inconsistently or inefficiently in the past.
Some of the methods that have been removed are:
.browser(),
.toggle(function,function,...) ( It should not be confused with the "change the visibility of an element" of .toggle() which is not deprecated. )
.live() etc
Why this jQuery Migrate Plugin?
On the official website of jQuery it has been mentioned that
"We realize that existing sites and plugins may be affected by these changes, and are providing the jQuery Migrate plugin for a transitional upgrade path."
This plugin can greatly simplify the process of moving older jQuery code to version 1.9.0 or higher of jQuery by identifying deprecated features.
This will help us find things that may cause upgrade issues when we move up from older jQuery versions, and to allow older code to work with either jQuery 1.9 or 2.0.
The jQuery Migrate plugin can be used with either 1.9 or 2.0 to detect deprecated and removed features, or to restore old features for those situations where we need old code to run with new jQuery.
How to use jQuery mIgrate in our code?
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>
API:
This plugin adds three properties to the jQuery object.
1.)jquery.migrateWarning
2.)jQuery.migrateMute
3.)jQuery.migrateTrace
jQuery.migrateWarning: This property is an array of string warning messages. These warning have been generated by the code on the page. There ordering in the array is same as in the order they were generated.
A point to remember is that messages appear in the array only once, even if the condition has occurred multiple times, unless jQuery.migrateReset() is called.
jQuery.migrateMute:n We set this property to true to prevent console warnings from being generated in the debugging version. Even though we set this property the jQuery.migrateWarnings array is still maintained, which allows programmatic inspection without console output.
jQuery.migrateTrace: we set this property to false if you want warnings but do not want traces to appear on the console.
jQuery.migrateReset(): This method clears the jQuery.migrateWarnings array.