Re: [w3c/webcomponents] Add Scoped CustomElementRegsitry explainer (#865)

Ok, so I think we're looking for clarification and changes to steps 17 and 18 in the Element definition_ steps: https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition

It seems like these steps need to be branched depending on whether the registry is the global registry or a scoped registry.

If it's the global registry:

- 17 stays the same:

   > Let document be this CustomElementRegistry's relevant global object's associated Document.

- 18 needs to be updated to exclude shadow roots with scoped registries:
  >  Let upgrade candidates be all elements that are shadow-including descendants of document, whose namespace is the HTML namespace and whose local name is localName, in shadow-including tree order. Additionally, if extends is non-null, only include elements whose is value is equal to name. _Exclude all elements whose root is a shadow root has a scoped custom element registry._

  or something like that.

If it's a scoped registry:

- Step 17 might need to get all the shadow roots associated with the registry. We can define an order for connected shadow roots by using either tree-order or the order in which the shadow roots were created.

   Creation order might be more efficient if registries have to keep a list of associated roots anyway. In that case we need to clarify if disconnected shadow roots are upgraded.

  If keeping references from registries to shadow roots is not desired (can they be weak references?), then we would need get the associated roots from the document. The order would then be document order and naturally exclude disconnected shadow roots.

- Step 18 starts with candidates that are shadow-excluding descendants of the roots from the previous step

I think in the explainer it would make sense to have a new section before *Finding a custom element definition* like *Element definition* to describe this.

@rniwa does this sound about right?

@rniwa @mfreed7 do you have guidance on whether registries should keep references to the associated shadow roots?

-- 
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/pull/865#issuecomment-699109365

Received on Friday, 25 September 2020 19:20:45 UTC