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: David Bruant <bruant.d@gmail.com>
Date: Mon, 24 Dec 2012 11:53:55 +0100
Message-ID: <50D83443.20905@gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
CC: Boris Zbarsky <bzbarsky@mit.edu>, www-dom@w3.org, Cameron McCormack <cam@mcc.id.au>, Bobby Holley <bholley@mozilla.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 24 December 2012 10:54:27 GMT