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

justinfagnani commented on this pull request.



> +      'local-element': LocalElement,
+    }
+});
+```
+
+### Finding a custom element definition
+
+Because there is no longer a single global custom element registry, when creating elements, the steps to look up a custom element definition need to be updated to be able to find the correct registry.
+
+That process needs to take a context node that is used to look up the definition. The registry is found by getting the context node's root. If the root has a CustomElementRegistry, use that registry to look up the definition, otherwise use the global objects CustomElementRegistry object.
+
+The context node is the node that hosts the element creation API that was invoked, such as `ShadowRoot.prototype.createElement()`, or `HTMLElement.prototype.innerHTML`. For `ShadowRoot.prototype.createElement()`, the context node and root are the same.
+
+#### Note on looking up registries
+
+One consequence of looking up a registry from the root at element creation time is that different registries could be used over time for some APIs like HTMLElement.prototype.innerHTML, if the context node moves between shadow roots. This should be exceedingly rare though.

I'll try to clean this up.

-- 
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#discussion_r384022150

Received on Tuesday, 25 February 2020 17:59:14 UTC