Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How well does the jQuery migrate plugin deal with deprecated code?

I will soon be tasked with upgrading to jQuery 1.9. That said I know a few places where we have live(); toggle(); hover(); and browser(); with a number of surprises on the way, -I'm sure.

If I add the migrate pluggin, will it continue to execute the old code -or just give me messages in the console to help me track down and fix things?

Has anyone made such a wide jump from 1.4.1 to 1.8 or 1.9? that has implemented the migrate pluggin and seen how well it works and the limitations?

like image 410
namretiolnave Avatar asked May 28 '13 16:05

namretiolnave


People also ask

Why we use jQuery migrate plugin?

Migrate plugin is created to simplify the transition from older versions of jQuery to newer ones . Upgrading libraries such as jQuery can be a lot of work, when new changes have been introduced.

Is jQuery migrate necessary?

Basically, jQuery Migrate helps older code talk to the new code. In most cases, this simply adds unnecessary load to your site. You can see this running if you launch Chrome Devtools console.

Can I remove jQuery migrate?

To remove jQuery Migrate using WP Rocket, goto WP Rocket plugin's setting >> File Optimization. Remove jQuery Migrate using WP Rocket cache plugin. Under the JavaScript Files section, you can check the box for Remove jQuery Migrate. That's it.

What is jQuery migrate in WordPress?

jQuery Migrate is essentially a helper script that allows developers to “migrate” to newer versions of jQuery. It is a backward-compatibility fix. The version of jQuery Migrate being re-added in WordPress 5.6 corresponds to newer versions of jQuery.


2 Answers

The oficial jQuery site describes it pretty well http://jquery.com/upgrade-guide/1.9/#jquery-migrate-plugin

The uncompressed development version of the jQuery Migrate plugin includes console log output to warn when specific deprecated and/or removed features are being used. This makes it valuable as a migration debugging tool for finding and remediating issues in existing jQuery code and plugins. It can be used for its diagnostics with versions of jQuery core all the way back to 1.6.4.

The compressed version of the plugin does not generate any log output, and can be used on production sites when jQuery 1.9 or higher is desired but older incompatible jQuery code or plugins must also be used. Ideally this would only be used as a short-term solution, but that's a decision for you to make.

like image 157
claustrofob Avatar answered Sep 29 '22 09:09

claustrofob


jQuery Migrate Plugin works just fine as jQuery.

Any deprecated feature will display warnings on the browser's console (if using plugin's uncompressed version and for IE browsers use Firebug Lite for console). In most cases these messages are simply warnings; code should continue to work properly as long as the jQuery Migrate plugin is used, but it is recommended to change the code where possible to eliminate warnings so that the plugin does not need to be used.

To find entire list of warning messages see https://github.com/jquery/jquery-migrate/blob/master/warnings.md

like image 37
sachin chavda Avatar answered Sep 29 '22 09:09

sachin chavda