Opened 12 years ago
Closed 11 years ago
#7796 closed bug (worksforme)
Selecting element by attribute value fails when a space exists before closing bracket.
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | selector | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
See jsFiddle example: http://jsfiddle.net/marcofucci/rRtAq/
If you try to select an element based on an attribute value, and leave an empty space directly prior to closing bracket, no value will be fetched.
Deletion of the space will remedy the problem.
This may not be considered a bug since adding enclosing quotations around the variable will also solve the issue, which is the proper syntax, but the given code sample works fine on prior versions of jQuery.
Change History (4)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → selector |
---|---|
Milestone: | 1.next → 1.4.5 |
Priority: | undecided → high |
Status: | new → open |
Thanks for taking the time to contribute to the jQuery project by writing a bug report.
This is a regression introduced with jQuery 1.4.4 in this Sizzle commit where the regexp is too greedy and includes the whitespace into the match for the attribute value. So input[name=/test ]
becomes input[name='test ']
instead of input[name='test']
comment:4 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | open → closed |
This does not seem to be a problem in jQuery git. http://jsfiddle.net/timmywil/qwcTA/5/
Posted incorrect jsFiddle link, here it is: http://jsfiddle.net/Dygerati/bQYhF/
Replying to [email protected]…: