Skip to main content

Bug Tracker

Side navigation

#7967 closed bug (invalid)

Opened January 14, 2011 05:03AM UTC

Closed January 14, 2011 04:53PM UTC

using multiple selector [type!=value] results in ignoring the negative selector and selects all elements

Reported by: zxurian@gmail.com Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

Test Case - http://jsfiddle.net/NAwrU/7/

Using $("input[type!='submit']") or $("#input[type!='hidden']) correctly selects all inputs of type not submit, or of type not hidden, but if you try to combine them $("input[type!='submit'], input[type!='hidden']) it instead selects all input elements.

Test case is linked at top

either of the first two lines works properly, but the third line incorrectly changes all elements.

Attachments (0)
Change History (1)

Changed January 14, 2011 04:53PM UTC by ajpiano comment:1

resolution: → invalid
status: newclosed

This is not a bug. I attempted to explain this last night on IRC but you must have missed the explanation. If you want to select elements that match all the criteria, you have to combine those criteria into a single selector.

$("input[type!='submit'][type!='hidden]")

The reason yours finds all the inputs is that first, it gets the inputs that don't have type "submit", which includes elements that do have the type "hidden". Then it gets all elements that don't have the type "hidden", which includes elements that do have the "submit". The comma that separates multiple selectors can be considered to be a logical OR, not AND.

http://jsfiddle.net/NAwrU/8/