RE: Prototypes for adopted nodes

In IE9, we switch the script context ownership of a given node when it is grafted into the primary markup for the adopting script context. In other words, simply referencing a node from a different script context is not sufficient to have its prototype ownerhip change; rather it must become part of the tree. 

We do this to ensure that all the nodes in a primary markup tree are consistently in the same prototype context.

-----Original Message-----
From: www-dom-request@w3.org [mailto:www-dom-request@w3.org] On Behalf Of Andrew Oakley
Sent: Monday, July 19, 2010 3:16 AM
To: www-dom@w3.org
Subject: Prototypes for adopted nodes

What "script context" should nodes belong to if they are adopted from one document to another?  By script context I mean which set of prototype objects are used.  This doesn't seem to be mentioned in the DOM 3 core adoptNode description.

I would expect the automatic adopting of nodes that browsers seem to be doing (rather than throwing WRONG_DOCUMENT_ERR) would have the same behaviour as using the adoptNode API.

On a related note which script context should be used if the
Document.create* APIs are used on different documents (e.g.
doc1.createTextNode.call(doc2, ...))?

I've uploaded a test case to http://ado.is-a-geek.net/www-dom/context/,
results don't seem to be consistent between different browsers.

Thanks

--
Andrew Oakley

Received on Monday, 9 August 2010 18:18:36 UTC