Ticket #185 (closed bug: fixed)
`]` breaks selectors
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0 |
| Component: | core | Version: | 1.0 |
| Keywords: | ] selector | Cc: | |
| Blocking: | Blocked by: |
Description
I want to select input files by their name, but ] seems to break jquery - no errors are thrown in my JS-console (ff). I use the latest svn co.
Here are some examples which break jquery:
$("input[@name='foobar[]']").hide();
$("input[@name='foobar[foobar]']").hide();
This does seem to work though:
$("input[@name^='foobar['").hide();
$("input[@name^='foobar[foobar'").hide();
The HTML would be:
<input name="foobar[]" />
<input name="foobar[foobar]" />
Hope you can fix this!
Change History
comment:2 Changed 7 years ago by john
- Status changed from closed to reopened
- Resolution fixed deleted
comment:3 Changed 7 years ago by mail@…
Woha, I found the test suite and have to say: Awesome! Debugging made easy. One more plus for jquery!
I changed two bugs within my fix, now all tests are passed.
http://nopaste.php-q.net/238501
Here is a suggestion for a test:
give input#hidden2 name="foo[bar]" t( "Grouped Form Elements", "input[@name='foo[bar]']", hidden2? );
comment:4 Changed 7 years ago by mail@…
Sorry, messed up the suggestion:
give input#hidden2 name="foo[bar]" t( "Grouped Form Elements", "input[@name='foo[bar]']", ["hidden2"] );
comment:5 Changed 7 years ago by joern
- Version changed from 1.0b1 to 1.0
Added test to SVN, it fails in FF and dies in IE
comment:7 Changed 7 years ago by mail@…
http://nopaste.php-q.net/238509
That is an updated version (I forgot to remove a debug msg)
"it fails in FF and dies in IE" - try it with my fix - it should work.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

So, I think I found the bug myself:
Line 1779:
This should be something like this:
.replace( 'Q', " *('|"|)([^'"]*?)4 *" ), "i" );But the backreference (4) only works for parse[1] obviously! Also now one more key exists in m - so we'll have to reorganize it.
Here is my fix: http://nopaste.php-q.net/238335
What I did: # removed arrays from jQuery.parse (I think we don't need those any longer) # count ( and S for the number of the backreference # changed Q regex # changed reorganizing of m
*Please test this* - it works for me, as far as I can tell!