Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11706 closed bug (fixed)

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

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 (6)

comment:1 Changed 5 years ago by rwaldron

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

comment:2 Changed 5 years ago by rwaldron

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

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 5 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 5 years ago by scottgonzalez

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Confirmed from the fiddle.

comment:5 Changed 5 years ago by scottgonzalez

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

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

comment:6 Changed 5 years ago by john.firebaugh

Great, thank you for investigating.

Note: See TracTickets for help on using tickets.