jQuery 1.4.4+ Upgrade: How to Fix Attribute Value Selector Errors

We recently upgraded the Sabramedia Newsroom jQuery library from 1.4.2 to 1.4.4. We noticed numerous subtle errors happening with input related markup. Upon investigation I found that various form input "attribute=value" selectors all stopped working. So the following jQuery selector code returns false:

As of 1.4.3 or 1.4.4 it is imperative to have double quotes surrounding the attribute value now.

How to fix this with a regular expression

For those of you who have used a lot of attribute selectors in your code this will be a frustrating upgrade to anything above jQuery 1.4.4. I used a regular expression to find and replace all instances with the corrected selector code. I am using Zend Studio for Eclipse. This code worked for us and in theory should work in all instances, but I do NOT recommend clicking the "Replace All" button. Use the Replace/Find method or simlar process in your IDE.

Find:

Replace:

 

Screenshot of me finding and replacing the code in Zend Studio for Eclipse.

 

Comments

  • There are no comments.
Add Comment