jQuery Migrate Plugin showing Errors

As per my knowledge, jQuery migrate restores the APIs that were removed, and shows warnings in the browser console when removed and/or deprecated APIs are used. “That way you can spot and fix what otherwise would have been errors.” – this is what they say.

I’m using jQuery migrate 1.4.1 with jQuery 2.2.4 and I’m expecting that my existing code will not break. But my code does break in many places.

[var].replace is not a function

Uncaught Error: Syntax error, unrecognized expression: #itemtarget
input[attrValue]!=””

[var] is not a string, hence the error. I understand.
I also understand that changing

$('#itemtarget input[attrValue]!=""').each(function () { //code here });

to

$("#itemtarget").find("input[attrValue != '']").each(function () { //code here });

fixes the second error.

But I do not want to be altering my code right now, I was hoping I’ll use Migrate Plugin and leave my code as is for the time-being.

Why is migrate plugin causing/not handling these errors?

9 thoughts on “jQuery Migrate Plugin showing Errors”

  1. from the jquery migrate page:

    Development vs. Production versions
    The production build is minified and does not generate console warnings. It will only generate a console log message upon loading, or if it detects an error such as an outdated version of jQuery that it does not support. Do not use this file for development or debugging, it will make your life miserable.

    are you using the minified version? this will suppress console warnings.

    Reply

Leave a Comment