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

Le 24/12/2012 10:38, Anne van Kesteren a écrit :
> On Mon, Dec 24, 2012 at 1:07 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> 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.
> Ah yes, such as DOMTokenList. And other specifications can potentially
> introduce more of those. Bah. (Maybe we can make "associated" an
> actual definition in DOM and specifications say "node can have/has an
> *associated* X object" and DOM can say to change the prototype of all
> *associated* objects...)
I agree with this idea.

Changing the prototype is fine if that's the way to solve the problem. 
Of course, adoptNode should change it right away (and not after a GC!).

One thing to keep in mind is that in ES6, it won't be possible to change 
the [[Prototype]] of an object with [[Extensible]]:false (it's currently 
the case in Firefox, I haven't tested others).
It means that nodes (and anything that can have its *associated object* 
changed) must throw on Object.preventExtensions/seal/freeze (I don't 
know what WebIDL currently says about that).

David

Received on Monday, 24 December 2012 10:54:26 UTC