Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#14381 closed bug (fixed)

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

Reported by: [email protected] Owned by: gibson042
Priority: low Milestone: 1.11/2.1
Component: selector Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:


  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/

Change History (5)

comment:1 Changed 9 years ago by dmethvin

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?

comment:2 in reply to:  1 Changed 9 years ago by gibson042

Owner: set to gibson042
Status: newassigned

Replying to 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.

comment:4 Changed 9 years ago by Richard Gibson

Resolution: fixed
Status: assignedclosed

Fix #14381: Update to Sizzle 1.10.11 (cherry picked from commit 64bdf4140b58c6dae72db78fc2f02832ed51a863)

Changeset: c93743b4faf7db5e2b95eee287adaece975541e3

comment:5 Changed 9 years ago by dmethvin

Component: unfiledselector
Milestone: None1.11/2.1
Priority: undecidedlow
Note: See TracTickets for help on using tickets.