Side navigation
#8641 closed bug (fixed)
Opened March 25, 2011 01:12PM UTC
Closed March 25, 2011 03:37PM UTC
jQuery 1.5.x bug when trying to get fields with names that have points as separator
Reported by: | gabrielmoreira@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.next |
Component: | unfiled | Version: | 1.5.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This sample works on 1.4.x
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> </head> <body> <input type='text' name='foo.bar'/> <script> $(document).ready(function() { console.log($('*[name=foo.bar]')); }); </script> </body> </html>
But doesn't work on 1.5.x
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> </head> <body> <input type='text' name='foo.bar'/> <script> $(document).ready(function() { console.log($('*[name=foo.bar]')); }); </script> </body> </html>
As you can see from the docs (http://api.jquery.com/attribute-equals-selector/), quotes are mandatory for attribute selectors. This has always been the case, but did work in 1.4, and now has been fixed. Attribute selectors that are only one word will still work, but any selectors separated by period or a space or certain other breaks will fail. See http://jsfiddle.net/timmywil/X8MwL/