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

On 24/12/12 11:07 AM, Boris Zbarsky wrote:
> 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
>     with.
>
> 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.

I wonder if we should add some default, like:

   Unless otherwise specified, any newly created platform object that is
   returned from an IDL attribute, operation, iterator or exception field
   is associated with the same global environment that the corresponding
   Function object that implements the attribute, operation, iterator
   or exception field is associated with.

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

There isn't really anything in the spec at the moment that says that the 
global environment that a platform object is associated with (and thus 
what its [[Prototype]] is) cannot change, but it would be good to 
clarify that.

Does it need to do anything other than change its [[Prototype]]?  I 
suppose per the ES spec you can't actually do that...

Received on Monday, 24 December 2012 00:24:30 UTC