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

LarsDenBakker commented on this pull request.



> +2. **Internal implementation elements:** A component may have private internal elements that it needs to register, but would prefer not to leak to the external environment.
+
+### Why use shadow roots as registration scopes?
+
+Shadow roots provide an encapsulation mechanism for isolating a DOM tree's, nodes, styles, and events from other scopes. The goal is to allow scopes to function without required coordination with other scopes. The globally shared custom element registry, however, requires coordination so that multiple scopes on a page agree on the registrations. Rather than invent a new scoping primitive to the DOM, it is natural to extend the shadow root scoping responsibilities to include custom element registrations.
+
+This approach also allows for a nice API by extending the DocumentOrShadowRoot interface and `ShadowRoot#attachShadow()`.
+
+## Overview
+
+This proposal allows user code to create new instances of `CustomElementRegistry`:
+
+```js
+const registry = new CustomElementRegistry();
+
+and associate them with a ShadowRoot:

`````suggestion
```
and associate them with a ShadowRoot:
```js
`````

-- 
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#pullrequestreview-362862525

Received on Friday, 21 February 2020 19:26:41 UTC