A JQuery-migrate Console Trick

I was recently testing jquery-migrate 3.3.1 upgrade from 3.0.0. The question came up about why we are still using migrate.

Its not us – its them.

Zombie libraries that still use outdated, deprecated shortcut names and methods of older versions of the JQuery API.

Anyway, with the build process we use it is not easy to replace the minified migrate file with the unminified debug version that tells you all the places your code hasn’t aged well.

I had already put this in the command line to make sure I was on the right version:

$.migrateVersion

and then realized I could add more value with this:

$.migrateVersion + ', ' + $.migrateWarnings

This gives a list of every warning even if you are running the minified version, which for me was enough to see where to look in the source code and libraries and tally up how many changes would be needed.

Chrome Live Expression
Live expression in Chrome

Be aware that the warnings are based on a simple pattern matcher. If you use lodash isFunction() JQuery will still list it as deprecated. Annoying.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *


3 + one =

This site uses Akismet to reduce spam. Learn how your comment data is processed.