W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2012

Re: [dom] Need to describe the interaction of adoptNode with prototype chains

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 22 Dec 2012 03:14:14 -0800
Message-ID: <50D59606.8000504@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: www-dom@w3.org
On 12/22/12 2:36 AM, Anne van Kesteren wrote:
> On Sat, Dec 22, 2012 at 1:07 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> In particular, what happens to the prototype of the ES reflection of an
>> element when it's adopted?  Does it depend on whether its proto chain was
>> earlier mutated by script or by web components stuff?
> Does anything need to happen?

Well... Should the proto remain the proto associated with the window of 
the old document, or should it become the proto associated with the 
window of the new document?

If it stays the old proto, then you'll have an element in the new 
document that tests false for instanceof against things in that window, no?

For what it's worth the attached testcase shows the following behavior 
at first glance:

Gecko: Changes the proto at adopt time
Chrome, Opera: Don't seem to change the proto in this testcase
Safari: Doesn't change proto at adopt time, ends up changing it later
         when it GCs, as far as I can tell.

I don't have IE on hand to test, but would be interested in knowing what 
should happen with IE.

And the question about how this all interacts with web components, if at 
all, remains.



   function report(el) {
     document.writeln(Object.getPrototypeOf(el) == 
     document.writeln(Object.getPrototypeOf(el) == 

   function f() {
     var div = document.createElement("div");


   var docEl = frames[0].document.documentElement;

   // Now try to trigger some garbage collection
   for (var i = 0; i < 1000000; ++i) {
Received on Saturday, 22 December 2012 11:14:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:01 UTC