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?

13 thoughts on “jQuery Migrate Plugin showing Errors”

Leave a Comment