Bug Tracker

Modify

Ticket #3430 (closed bug: wontfix)

Opened 5 years ago

Last modified 5 years ago

is() function not handling expressions properly

Reported by: tremby Owned by: flesler
Priority: major Milestone: 1.3
Component: selector Version: 1.2.6
Keywords: Cc: tremby
Blocking: Blocked by:

Description

$("body").is("div span") is returning true

it should always return false, since a body element is /not/ a span element which is a descendant of a div element.

is() seems to return true if there are any two things separated by space, for instance $(whatever).is(".bigclass .otherclass")

Change History

comment:1 Changed 5 years ago by flesler

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

is() doesn't support complex selectors (those including spaces, >, etc). We might add this for 1.3.

comment:2 Changed 5 years ago by flesler

  • Component changed from unfilled to selector

comment:3 Changed 5 years ago by tremby

can you at least mention that in the documentation? it only says it supports "expressions", which anyone would logically assume means anything on the "selectors" page of the docs.

comment:4 Changed 5 years ago by flesler

  • Cc tremby added

From  http://docs.jquery.com/Traversing/is.

'''Note:''' Only simple expressions are supported. Complex expressions, such as those containing hierarchy selectors (such as +, ~, and >) will always return 'true'.

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.