diff --git a/proposals/Scoped-Custom-Element-Registries.md b/proposals/Scoped-Custom-Element-Registries.md index b95df322..359f5892 100644 --- a/proposals/Scoped-Custom-Element-Registries.md +++ b/proposals/Scoped-Custom-Element-Registries.md @@ -60,6 +60,8 @@ registry.define('other-element', OtherElement); Definitions in this registry do not apply to the main document, and vice-versa. The registry must contain definitions for all elements used. +Note that, in the above example, `` is scoped to the shadow root inside of ``. So `` is defined within the scoped registry, not ``. + Once a registry and scope are created, element creation associated with the scope will use that registry to look up custom element definitions: ```js @@ -119,6 +121,23 @@ As a result, it must limit constructors by default to only looking up registrati This poses a limitation for authors trying to use the constructor to create new elements associated to scoped registries but not registered as global. More flexibility can be analyzed post MVP, for now, a user-land abstraction can help by keeping track of the constructor and its respective registry. +### Note on light DOM custom elements + +Custom elements that use light DOM (i.e. that don't call `this.attachShadow()`) may be scoped, but they must be scoped within a shadow root. For example: + +```html + + + #shadow-root (registry=myCustomRegistry) + +
Light DOM
+
+
+ +``` + +In the above example, `` is scoped within the shadow root of its containing ``, whereas `` is defined at the global document level. + ## API ### CustomElementRegistry