Re: [WICG/webcomponents] Scoped Custom Element Registry: Moving elements with shadow roots between documents (#907)

> > We definitely don't want a scoped registry to be settable everywhere. That will lead to all sorts of havocs like changing the registry of a custom element in the middle of constructing or upgrading an element.
> 
> Oh! that's a very interesting observation @rniwa, I wasn't aware that the registry was also sensible to this kind of issue. To try to understand better this issue, this means that the element has a reference back to the registry (directly or indirectly) in order to carry on the node reactions (connect/disconnect/adopt/etc.). Is this statement correct? For some reason, I was assuming that the node was cache these during creation via internal slots.

That's not what we do in WebKit. But I'm not certain what problem(s) that kind of back reference will solve even if we did?

> [I]s it because the result of the construction process must return an instance that is valid for the associated registry, and this might not be true if the registry changes during the construction process?

Yes. An upgrade of a custom element only makes sense in the context of a single custom element registry. Relatedly, if we're trying to upgrade a list of newly defined elements in `define` call, changing the registry of the shadow root mid way through it would result in non-sensical results.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/907#issuecomment-824433988

Received on Wednesday, 21 April 2021 23:41:39 UTC