Skip to main content

Bug Tracker

Side navigation

#14381 closed bug (fixed)

Opened September 23, 2013 10:11PM UTC

Closed October 11, 2013 06:14PM UTC

Last modified November 15, 2013 05:51PM UTC

.add() throws "no such interface" in IE when adding nodes from another window

Reported by: paradeofhope@gmail.com Owned by: gibson042
Priority: low Milestone: 1.11/2.1
Component: selector Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

1. Open a new window, either with target="_blank" or window.open

2. In child window, create a bag of nodes with $(...), containing at least one node

3. Add a node from the parent window, using collection.add(...)

  • Expected (actual in Chrome and FF): the collection now contains elements from both windows
  • Actual (Internet Explorer 10): throws error "No such interface supported"

This happens because .add() uses Node.compareDocumentPosition on line 1704 (jquery-1.10.2). Internet Explorer appears unable to use that function against nodes from different windows

Test case: http://jsbin.com/etUvODu/2/

Attachments (0)
Change History (5)

Changed September 24, 2013 07:20PM UTC by dmethvin comment:1

See this documentation: http://www.w3.org/DOM/faq.html#ownerdoc

Technically you are supposed to use .adoptNode() or .importNode() in these cases. It's rare enough that I don't think we would want to add code to guard against it everywhere.

Perhaps it could be turned into a $.fn.adopt() method that called .adoptNode() on the nodes to make it safe to append them?

Changed September 24, 2013 08:10PM UTC by gibson042 comment:2

owner: → gibson042
status: newassigned

Replying to [comment:1 dmethvin]:

Perhaps it could be turned into a $.fn.adopt() method that called .adoptNode() on the nodes to make it safe to append them?

These is obviously a rare case (and no doubt present for a looong time), but the root issue is in Sizzle's uniqueSort, not jQuery append. I'm willing to look into it.

Changed September 26, 2013 07:54PM UTC by gibson042 comment:3

Changed October 11, 2013 06:14PM UTC by Richard Gibson comment:4

resolution: → fixed
status: assignedclosed

Fix #14381: Update to Sizzle 1.10.11

(cherry picked from commit 64bdf4140b58c6dae72db78fc2f02832ed51a863)

Changeset: c93743b4faf7db5e2b95eee287adaece975541e3

Changed November 15, 2013 05:51PM UTC by dmethvin comment:5

component: unfiledselector
milestone: None1.11/2.1
priority: undecidedlow