Skip to main content

Bug Tracker

Side navigation

#6826 closed bug (duplicate)

Opened July 26, 2010 07:39AM UTC

Closed October 15, 2010 02:39AM UTC

Last modified October 15, 2010 02:39AM UTC

$('input[value=...]') doesn't work correctly in Firefox, Chrome, and Safari

Reported by: jaeheung Owned by:
Priority: undecided Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: value attribute selector Cc:
Blocked by: Blocking:
Description

Try the attached test code.

Click one of three words in the first line to change the value of the text box, and push the button to test various selectors.

It works as expected in IE. It should show:

1 0 0

1 0 0

or

0 1 0

0 1 0

or

0 0 1

0 0 1

depending on the selected value.

But it shows strange results in non-IE browsers.

Attachments (1)
  • t.html (0.9 KB) - added by jaeheung July 26, 2010 07:43AM UTC.

    test page

Change History (5)

Changed October 02, 2010 03:28AM UTC by addyosmani comment:1

priority: → undecided

Tests across browsers using submitted code sample:

Chrome 6.04:

Original: {100,100}, One: {100, 100}, Two Words: {100, 101}

FireFox 3.6.10:

Original: {100,100}, One: {100, 100}, Two Words: {100, 101}

IE9:

Original: {100,100}, One: {010, 010}, Two Words: {001,001}

On first glances it would appear that FireFox and Chrome are behaving incorrectly, however if you set the input value to one of those terms explicitly (without JS setting the input value dynamically), you'll see these browsers working perfectly fine with the given selectors:

One: http://jsfiddle.net/Zjt7j/3/

Two Words: http://jsfiddle.net/Zjt7j/4/

(we get the same results as in IE)

Going back to your original code..

I don't believe the problem is that jQuery isn't able to use the selectors correctly (as confirmed above). I believe there may be a quirk in the way the input value is being dynamically set (however that said, it looks fine to me).

Requesting an additional review to clarify whether the issue is indeed as I suspect, with the way the input value is being set or whether this is symptomatic of a larger problem.

Changed October 07, 2010 09:23PM UTC by adipose comment:2

I just submitted what appears to be a duplicate of this bug.

http://dev.jquery.com/ticket/7128

I ended up using filter() instead to get the desired results.

Changed October 07, 2010 09:24PM UTC by adipose comment:3

I forgot to mention the workaround:

$('@input[value=...]') works, for some reason.

$('&input[value=...]') also works. I have no idea why.

Changed October 15, 2010 02:39AM UTC by addyosmani comment:4

resolution: → duplicate
status: newclosed

As the content's of your second bug report (#7128) on this issue mimic quite a lot of the core issues explained via your test case in this ticket, I am closing this ticket as a duplicate. We've managed to make some further progress in the discussion on how this bug should be handled there and I think there is greater benefit in continuing the attempt to resolve this bug through that ticket instead of leaving two open.

Changed October 15, 2010 02:39AM UTC by addyosmani comment:5

Duplicate of #7128.