Skip to main content

Bug Tracker

Side navigation

#185 closed bug (fixed)

Opened September 07, 2006 08:30PM UTC

Closed September 15, 2006 05:52PM UTC

`]` breaks selectors

Reported by: anonymous Owned by:
Priority: major Milestone: 1.0
Component: core Version: 1.0
Keywords: ] selector Cc:
Blocked by: Blocking:
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!

Attachments (0)
Change History (8)

Changed September 08, 2006 04:48PM UTC by mail@milianw comment:1

resolution: → fixed
status: newclosed

So, I think I found the bug myself:

Line 1779:

    .replace( 'Q', " *'?"?([^'"]*?)'?"? *" ), "i" );

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!

Changed September 08, 2006 07:11PM UTC by john comment:2

resolution: fixed
status: closedreopened

Changed September 09, 2006 03:13PM UTC by mail@milianw comment:3

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"] );

Changed September 09, 2006 03:14PM UTC by mail@milianw comment:4

Sorry, messed up the suggestion:

give input#hidden2 name="foo[bar]"
t( "Grouped Form Elements", "input[@name='foo[bar]']", ["hidden2"] );

Changed September 09, 2006 05:56PM UTC by joern comment:5

version: 1.0b11.0

Added test to SVN, it fails in FF and dies in IE

Changed September 11, 2006 01:51PM UTC by mail@milianw comment:6

It fails with the old jquery filter, or?

Not with my fix?

Changed September 11, 2006 02:13PM UTC by mail@milianw comment:7

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.

Changed September 15, 2006 05:52PM UTC by joern comment:8

resolution: → fixed
status: reopenedclosed

Added proposed fix to SVN, tested on FF 1.5.0.6, IE6 and Opera 9.01 works fine.