Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 12 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:


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 13 years ago.

Download all attachments as: .zip

Change History (7)

Changed 13 years ago by dwt

Attachment: reduction.html added

comment:1 Changed 13 years ago by dwt

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

comment:2 Changed 13 years ago by ajpiano

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


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 13 years ago by dmethvin

Component: unfiledselector

comment:4 Changed 12 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:5 Changed 12 years ago by snover

Priority: undecided
Resolution: duplicate
Status: newclosed

comment:6 Changed 12 years ago by snover

Duplicate of #5482.

Note: See TracTickets for help on using tickets.