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: Sun, 23 Dec 2012 16:07:32 -0800
Message-ID: <50D79CC4.8070600@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: www-dom@w3.org, Cameron McCormack <cam@mcc.id.au>, Bobby Holley <bholley@mozilla.com>
On 12/23/12 1:09 AM, Anne van Kesteren wrote:
> What happens with document.open()? Does that replace the proto as well?

In Gecko?

I think it might do something weird like replacing the proto chain for 
descendants of the document but not all of the nodes that have it as 
ownerDocument or something.  Bobby might know.

What it should do per spec... I have no idea.  :(

Note also that Gecko will update the proto on some other things that 
hang off Elements as well (whichever ones we've thought about), but not 
all of them.  It's a bit ad-hoc at the moment.

> How do I go about defining replacing the proto of an element?

That's a good question.  It at least partially depends on how this needs 
to interact with web components.

> Are there any other places where this happens in the platform?

Not that I know of, apart from adoptNode and document.open().

Note that there's the question of what the right proto is to use for the 
element to start with.  I _think_ that's meant to be defined in WebIDL 
section 4.6, which says:

    Every platform object is associated with a global environment, just
    as the initial objects are. It is the responsibility of
    specifications using Web IDL to state which global environment (or,
    by proxy, which global object) each platform object is associated

and then:

   The value of the internal [[Prototype]] property of the platform
   object is the interface prototype object of the primary interface
   from the platform object’s associated global environment.

I will bet $50 that there are no specs that actually define which global 
environment their objects are associated with.  ;)  The DOM spec 
certainly doesn't seem to, and I think it had the best chance of them all.

> Is the right place in DOM or should IDL provide a hook for it?

I think WebIDL should provide a hook for changes to the global 
environment an object is associated with.  And then we should coordinate 
between WebIDL and Web components for how they should interact.  And 
specs will need to define the global environment bit, including when (or 
if) it changes.

Received on Monday, 24 December 2012 00:08:06 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:19 UTC