Skip to main content

Bug Tracker

Side navigation

#11355 closed bug (duplicate)

Opened February 16, 2012 03:08PM UTC

Closed June 19, 2012 06:38AM UTC

Last modified June 19, 2012 06:38AM UTC

":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:
Description

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
Attachments (0)
Change History (6)

Changed February 16, 2012 03:31PM UTC by rwaldron comment:1

status: newopen

Confirmed, with slightly less chaotic fiddle...

http://jsfiddle.net/rwaldron/Z8u5F/

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

Changed February 16, 2012 03:32PM UTC by rwaldron comment:2

cc: → dmethvin, timmywil

Changed February 16, 2012 03:45PM UTC by dmethvin comment:3

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?

Changed February 16, 2012 03:49PM UTC by timmywil comment:4

component: unfiledselector
priority: undecidedlow

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

Changed June 19, 2012 06:38AM UTC by timmywil comment:5

resolution: → duplicate
status: openclosed

Changed June 19, 2012 06:38AM UTC by timmywil comment:6

Duplicate of #11735.