Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7205 closed bug (invalid)

subtle difference in how :has() and .has() behave

Reported by: Tomalak Owned by:
Priority: low Milestone:
Component: selector Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

The ":has()" Sizzle selector and the ".has()" jQuery function behave differently when the child selector ">" is used in a special (unary) way.

The goal is to select elements if they have certain children (not descendants).

$("ul:has(>li.active)");    // returns expected elements
$("ul").has(">li.active");  // returns empty

Also see this Fiddle and this StackOverflow thread.

Version info: Tested and reproduced on FireFox 3.6, FireFox 4.0b6, Chrome 8.0.522.0 and IE9b (all Windows). It occurs with jQuery 1.3.2 through 1.4.3.

Change History (3)

comment:1 Changed 9 years ago by snover

Component: unfiledselector
Milestone: 1.next
Priority: undecidedlow
Status: newopen
Version: 1.4.21.4.3

comment:2 Changed 9 years ago by BrianJG

I have requested clarification on the proper interpretation of "> Child" and resultant selection in the core discussion.

comment:3 Changed 9 years ago by danheberden

Resolution: invalid
Status: openclosed
Note: See TracTickets for help on using tickets.