Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11355 closed bug (duplicate)

":input[value]" and ":input:not([value])" returning wrong elements

Reported by: jmabey Owned by:
Priority: low Milestone: None
Component: selector Version: 1.7.1
Keywords: Cc: dmethvin, timmywil
Blocked by: Blocking:


I'm using the selectors :input[value] and :input:not([value]), and they appear to be returning the opposite of what is expected.

Suppose there is a page with one element on it: <input name="a">

  • :input[value] selects the element.
  • :input:not([value]) does not select the element.

Using input instead of :input returns the expected result:

  • input[value] does not select the element.
  • input:not([value]) selects the element.

Test case: http://jsfiddle.net/jmabey/f9fH7/

With 1.7.1:

  • Reproducible in Firefox 3.6.26 and 10.0.1, Chrome 17, Opera 11.61, Safari 5.1.2, IE 7-9
  • IE 7 and 8's results are inconsistent with other browsers
  • Operating systems: Ubuntu 11.10 and Windows 7

With 1.6.4:

  • Works as expected in same browsers

Change History (6)

comment:1 Changed 11 years ago by Rick Waldron

Status: newopen

Confirmed, with slightly less chaotic fiddle...


I'm not sure this is a case that we should bother investing time fixing... special jQuery only selectors, like ":input", are on track for deprecation.

I'm going to cc dmethvin and timmywil to weigh in on this

comment:2 Changed 11 years ago by Rick Waldron

Cc: dmethvin timmywil added

comment:3 Changed 11 years ago by dmethvin

The problem is Sizzle's occasional confusion between properties and attributes; an input always has a value property. In IE7 all of the [value] ones fail; timmywil is this even something we can fix in IE7?

comment:4 Changed 11 years ago by timmywil

Component: unfiledselector
Priority: undecidedlow

yes, if the value attrhook was removed. Similar to #9830.

comment:5 Changed 11 years ago by timmywil

Resolution: duplicate
Status: openclosed

comment:6 Changed 11 years ago by timmywil

Duplicate of #11735.

Note: See TracTickets for help on using tickets.