Re: Adopting a Custom Element into Another Document

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


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


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


-- 
https://annevankesteren.nl/

Received on Tuesday, 13 January 2015 19:27:41 UTC