Re: [w3c/webcomponents] Scoped Custom Element Registries (#716)

@rniwa 

>> While OtherElement instances are never upgraded because all div's shadow roots are using scoped registries.

> I don't think this is right. this.attachShadow in SomeElement didn't specify any registry so it should be using the global registry.

I think you're right, let me update my comment above to reflect that `OtherElement` instances for `SomeElement` inserted in the main window should get upgraded. Can you take a look at my previous comment again?

> If it automatically "inherited" parent shadow tree's registry, then this raises a new question. What happens when SomeElement is instantiated outside of a shadow tree then inserted into another shadow tree with a scoped registry. Note that this is precisely what happens in synchronous element construction case (e.g. by using new) so this behaving differently from the upgrade case is extremely confusing.

I was under the impression that we have some previous agreements about these cases: when an element is created, and connected to a shadow root, the lookup will occur at that point, while `attachShadow()` will have no side effects on the matter other than setting up the registry to be used if provided.

> In other words, is the shadow tree's custom element registry determined at the time it's attached or is it dynamically determined by the tree structure. In order to have the semantics you described and not have an inconsistency between upgrade and synchronous construction case, we need to do the dynamic determination. But this poses yet another issue about temporarily detaching an element from a shadow tree so it's not great either.

In the explainer, it is listed as dynamically determined by the tree structure. This also opens the door for replacing the registry at any given time, as a possibility, or just replacing the registry when adopted by another document, etc.

About the temporarily detaching an element issue that you mentioned above, can you provide more information? Maybe another example? The way I see it, if an element is upgraded already (dynamically or via sync construction), and that element is temporarily detaching (while moving it around), it should not have any side effects on any already upgraded element from its shadow root.

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

Received on Wednesday, 26 August 2020 22:34:59 UTC