Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#6322 closed bug (duplicate)

:has() does not correctly select elements if multiple criteria are inside

Reported by: dwt Owned by:
Priority: undecided Milestone:
Component: selector Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

This testcase returns false, true true

var hasFoundwithClass = 1 === $('#contingent tbody tr:has(.name:contains("foo"))').length;
var hasFoundWithoutClass = 1 === $('#contingent tbody tr:has(:contains("foo"))').length;
var hasFoundWithOnlyClass = 1 === $('#contingent tbody tr:has(.name)').length;

While I believe that all three selectors should select the same node.

Testcase attached.

Attachments (1)

reduction.html (819 bytes) - added by dwt 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by dwt

Attachment: reduction.html added

comment:1 Changed 10 years ago by dwt

jsbin as per ajpianos request http://jsbin.com/atogo3/edit

comment:2 Changed 10 years ago by ajpiano

This appears to be more complex than simply being an issue with multiple selections inside of :has()

http://jsbin.com/atogo3/15

The strangest manifestation of this issue is that with the provided markup, $("tr:has(:contains(foo).name)") returns 1 element, while $("tr:has(.name:contains(foo))") returns 0 elems.

In the case of the initial selection, jQuery never even enters the pseudoselector code that handles :contains.

comment:3 Changed 10 years ago by dmethvin

Component: unfiledselector

comment:4 Changed 9 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:5 Changed 9 years ago by snover

Priority: undecided
Resolution: duplicate
Status: newclosed

comment:6 Changed 9 years ago by snover

Duplicate of #5482.

Note: See TracTickets for help on using tickets.