Bug Tracker

Modify

Ticket #11355 (closed bug: duplicate)

Opened 16 months ago

Last modified 12 months ago

":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
Blocking: Blocked by:

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

Change History

comment:1 Changed 16 months ago by rwaldron

  • Status changed from new to open

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

comment:2 Changed 16 months ago by rwaldron

  • Cc dmethvin, timmywil added

comment:3 Changed 16 months 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 16 months ago by timmywil

  • Priority changed from undecided to low
  • Component changed from unfiled to selector

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

comment:5 Changed 12 months ago by timmywil

  • Status changed from open to closed
  • Resolution set to duplicate

comment:6 Changed 12 months ago by timmywil

Duplicate of #11735.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.