Bug Tracker

Modify

Ticket #7967 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

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

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

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.

Change History

comment:1 Changed 2 years ago by ajpiano

  • Status changed from new to closed
  • Resolution set to invalid

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/

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.