Reputation: 682
I have quick question about jQuery plugins, hope somebody out there has some advice.
I'm working with a jQuery plugin that has been working as expected, but in the last couple of days we upgraded from jQuery 1.1.4 to 1.4.2.
After a lot of debugging, I was able to realize that in the old plugin, selectors are written as follows:
$('img[@id&=myImage]').each ...
Once we upgraded to the latest version of jQuery, I started getting JavaScript errors as follows:
uncaught exception: Syntax error, unrecognized expression: [@id&=myImage]
As you can see, the selector includes an "@" symbol (which I believe is the one causing the error) and after consulting the jQuery documentation about all the different type of selectors, I was not able to find whether this was correct or not, given that it worked before and now it doesn't.
At this point I have to figure out if I can use the old plugin with the new version of jQuery or if I have to come up with an alternative solution.
I'd appreciate any advice.
Thanks
Upvotes: 2
Views: 1047
Reputation: 1929
It all boils down to the pros and cons of upgrading.
Pros for upgrading are :
Cons :
You could take a decision based on the cost and time estimate of the above. If there are just 1 or 2 plugins that needs a little tweaking, I would say definitely go ahead and upgrade .
However if you have a dozen plugin that break and you would have to rewrite almost 50 - 60% of your frontend code again, then you have a tough call to make :)
Upvotes: 2
Reputation: 630429
The @
for attribute selectors was removed in jQuery 1.3, just take it out, like this:
$('img[id^=myImage]').each(...);
Also I'm not sure what &=
would have referred to, I think you want one of the other attribute selectors here, possibly starts-with (^=
) or ends-with ($=
)?
Upvotes: 4