- From: Domenic Denicola <d@domenic.me>
- Date: Tue, 13 Jan 2015 19:43:13 +0000
- To: Ryosuke Niwa <rniwa@apple.com>, Anne van Kesteren <annevk@annevk.nl>
- CC: Webapps WG <public-webapps@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
I imagine this has all been discussed before, but why do __proto__-munging when adopting cross document? That seems bizarre, and causes exactly these problems. When you put an object in a Map from another realm, it doesn't __proto__-munge it to that other realm's Object.prototype. Why is the tree data structure embodied by the DOM any different? -----Original Message----- From: Ryosuke Niwa [mailto:rniwa@apple.com] Sent: Tuesday, January 13, 2015 14:37 To: Anne van Kesteren Cc: Webapps WG; Boris Zbarsky Subject: Re: Adopting a Custom Element into Another Document On Jan 13, 2015, at 11:27 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > On Tue, Jan 13, 2015 at 8:15 PM, Ryosuke Niwa <rniwa@apple.com> wrote: >> By "the same thing", do you mean that they will manually change >> __proto__ themselves? > > Yes. > > >> Let's say we have MyElement that inherits from HTMLElement and we're >> adopting an instance of this element (let's call it myElement) from a >> document A to document B; MyElement is currently defined in A's >> global object. >> >> I have two questions: >> >> Why did we decide to let custom elements handle this themselves >> instead of doing it in the browser? > > With two realms it's not a given that both realms use the same custom > element registry. (As you acknowledge.) Okay. >> When "myElement" is adopted into B, there is no guarantee that >> MyElement is also defined in B. Does that mean MyElement may need to >> create another class, let us call this MyElementB, in the B's context >> that inherits from B's HTMLElement? > > Well, if you control both realms I would assume you would give the same name. I'm not sure I understand what you mean by that. The name of the new class MyElementB isn't important. Do you agree that the author has to create a new class in B if there is no definition of MyElement there? But how do we even determine whether MyElement's defined in B? And if did, how do we get the class's prototype? >> Didn't Boris say Gecko needs to do this synchronously in order to >> enforce their security policy? > > I don't think that's conclusive, though if it turns out that's the > case we would need different timing between normal and custom > elements, yes. Great. Thanks for the clarification. - R. Niwa
Received on Tuesday, 13 January 2015 19:43:41 UTC