Bug Tracker

Ticket #14381 (closed bug: fixed)

Opened 18 months ago

Last modified 17 months ago

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

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


  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

comment:1 follow-up: ↓ 2 Changed 18 months 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 18 months ago by gibson042

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

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 18 months ago by Richard Gibson

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

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

Changeset: c93743b4faf7db5e2b95eee287adaece975541e3

comment:5 Changed 17 months ago by dmethvin

  • Priority changed from undecided to low
  • Component changed from unfiled to selector
  • Milestone changed from None to 1.11/2.1
Note: See TracTickets for help on using tickets.