Bug Tracker

Modify

Ticket #6322 (closed bug: duplicate)

Opened 3 years ago

Last modified 2 years ago

: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:
Blocking: Blocked by:

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

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

Change History

Changed 3 years ago by dwt

comment:1 Changed 3 years ago by dwt

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

comment:2 Changed 3 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 3 years ago by dmethvin

  • Component changed from unfiled to selector

comment:4 Changed 3 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

comment:5 Changed 2 years ago by snover

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to duplicate

comment:6 Changed 2 years ago by snover

Duplicate of #5482.

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.