Bug Tracker

Modify

Ticket #11706 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

`.has()` fails on document fragments

Reported by: john.firebaugh Owned by: rwaldron
Priority: low Milestone: 1.8
Component: traversing Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

While :has works correctly, .has() returns an empty selection whenever the selection is a document fragment. Once the fragment is inserted in the document, it works as expected.

Test case:

$('<div><span></span></div>').has('span').length

Expected: 1 Actual: 0

 http://jsfiddle.net/q5YWT/

Change History

comment:1 Changed 2 years ago by rwaldron

  • Owner set to rwaldron
  • Status changed from new to assigned

comment:2 Changed 2 years ago by rwaldron

  • Status changed from assigned to closed
  • Resolution set to worksforme

This is not even possible, as we have unit tests that would catch such a regression.

Also, your test case doesn't support your claim.

comment:3 Changed 2 years ago by anonymous

Sorry, what?

I just ran fiddle test case in Chrome 18, Firefox 12, and Safari 5.1. All failed.

Please reopen.

comment:4 Changed 2 years ago by scott.gonzalez

  • Status changed from closed to reopened
  • Resolution worksforme deleted

Confirmed from the fiddle.

comment:5 Changed 2 years ago by scott.gonzalez

  • Priority changed from undecided to low
  • Resolution set to fixed
  • Status changed from reopened to closed
  • Component changed from unfiled to traversing
  • Milestone changed from None to 1.8

This is working in master. rwaldron switched to jQuery edge before testing, which is why he didn't see the failure.

comment:6 Changed 2 years ago by john.firebaugh

Great, thank you for investigating.

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.