Skip to main content

Bug Tracker

Side navigation

#11706 closed bug (fixed)

Opened May 05, 2012 05:15PM UTC

Closed May 10, 2012 03:44PM UTC

Last modified May 10, 2012 04:05PM UTC

`.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/

Attachments (0)
Change History (6)

Changed May 07, 2012 04:21PM UTC by rwaldron comment:1

owner: → rwaldron
status: newassigned

Changed May 07, 2012 04:28PM UTC by rwaldron comment:2

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.

Changed May 10, 2012 05:24AM UTC by anonymous comment:3

Sorry, what?

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

Please reopen.

Changed May 10, 2012 12:50PM UTC by scottgonzalez comment:4

resolution: worksforme
status: closedreopened

Confirmed from the fiddle.

Changed May 10, 2012 03:44PM UTC by scottgonzalez comment:5

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.

Changed May 10, 2012 04:05PM UTC by john.firebaugh comment:6

Great, thank you for investigating.