Ticket #8058 (closed bug: duplicate)
attribute ends with selector breaks in 1.4.4
| Reported by: | gerads@… | Owned by: | |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.5 |
| Component: | selector | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
$(':input[name$=[bar]]') no longer works correctly with the latest update.
<input type='text' name='foo[bar]'>
<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script> console.log('1.4.4: ' + $(':input[name$=[bar]]').length); // => 0 </script>
<script src="http://code.jquery.com/jquery-1.4.3.js"></script>
<script> console.log('1.4.3: ' + $(':input[name$=[bar]]').length); // => 1 </script>
Change History
comment:1 in reply to: ↑ description Changed 2 years ago by anonymous
comment:2 Changed 2 years ago by jitter
- Priority changed from undecided to blocker
- Resolution set to duplicate
- Status changed from new to closed
- Component changed from unfiled to selector
- Milestone changed from 1.next to 1.5
Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!
This is a known regression and has been reported numerous times. You wouldn't have run into this issue when using the syntax recommended on api.jquery.com. Which says "Quotes are mandatory." for attribute values in attribute selectors. Like this
$(':input[name$="[bar]"]')
It has been fixed, you can check that with the recently released 1.5rc1 version in this test case
comment:4 Changed 2 years ago by anonymous
funny. http://jsfiddle.net/6fHR5/3/
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

http://jsfiddle.net/6F4W8/