Skip to main content

Bug Tracker

Side navigation

#13797 closed bug (fixed)

Opened April 20, 2013 01:49AM UTC

Closed April 20, 2013 03:53PM UTC

Last modified April 20, 2013 06:02PM UTC returns incorrect result if used to check $(this) or $(e.currentTarget) and a positional pseudoselector is used

Reported by: Owned by:
Priority: low Milestone: None
Component: traversing Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

This fiddle is the most reduced that shows the error:

This fiddle shows why :first-child isn't suitable sometimes:

This fiddle shows a workaround, apparently it works correctly if you pass a jQuery object into is instead of a selector.

Attachments (0)
Change History (4)

Changed April 20, 2013 02:59AM UTC by comment:1

problem isolated by ryanbrill to be due to the context being set from document to the element is is being called from.

Can be worked around by writing $(e.currentTarget).parent(), 'selector:first') instead of $(e.currentTarget).parent().is('selector:first')


Stackoverflow post:

Changed April 20, 2013 03:53PM UTC by Richard Gibson comment:2

resolution: → fixed
status: newclosed

Fix #13797: .is with single-node context

(cherry picked from commit 4f786ba4d2a5544cb48f589d2659d6cab84efc34)

Changeset: fb1731ab163424e22bac4372f15cda1195bfaa85

Changed April 20, 2013 05:41PM UTC by gibson042 comment:3

This ticket is now resolved, but I [ strongly recommend] ''against'' sending positional selectors to .is. Please consider something with more obvious behavior, like using jQuery( positionalSelector ).is( e.currentTarget ) directly (reversing the context and argument).

Changed April 20, 2013 06:02PM UTC by gibson042 comment:4

component: unfiledtraversing
priority: undecidedlow