Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11706 closed bug (fixed)

`.has()` fails on document fragments

Reported by: john.firebaugh Owned by: Rick Waldron
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 11 years ago by Rick Waldron

Owner: set to Rick Waldron
Status: newassigned

comment:2 Changed 11 years ago by Rick Waldron

Resolution: worksforme
Status: assignedclosed

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

Resolution: worksforme
Status: closedreopened

Confirmed from the fiddle.

comment:5 Changed 11 years ago by scottgonzalez

Component: unfiledtraversing
Milestone: None1.8
Priority: undecidedlow
Resolution: fixed
Status: reopenedclosed

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

comment:6 Changed 11 years ago by john.firebaugh

Great, thank you for investigating.

Note: See TracTickets for help on using tickets.