diff --git a/proposals/Scoped-Custom-Element-Registries.md b/proposals/Scoped-Custom-Element-Registries.md index b95df32..b8b5abb 100644 --- a/proposals/Scoped-Custom-Element-Registries.md +++ b/proposals/Scoped-Custom-Element-Registries.md @@ -45,7 +45,7 @@ and associate them with a ShadowRoot: ```js export class MyElement extends HTMLElement { constructor() { - this.attachShadow({mode: 'open', registry}); + this.attachShadow({mode: 'open', customElements: registry}); } } ``` @@ -70,7 +70,7 @@ These scoped registries will allow for different parts of a page to contain defi ### Creating and using a `CustomElementRegistry` -A new `CustomElementRegistry` is created with the `CustomElementRegistry` constructor, and attached to a ShadowRoot with the `registry` option to `HTMLElement.prototype.attachShadow`: +A new `CustomElementRegistry` is created with the `CustomElementRegistry` constructor, and attached to a ShadowRoot with the `customElements` option to `HTMLElement.prototype.attachShadow()`: ```js import {OtherElement} from './my-element.js'; @@ -80,7 +80,7 @@ registry.define('other-element', OtherElement); export class MyElement extends HTMLElement { constructor() { - this.attachShadow({mode: 'open', registry}); + this.attachShadow({mode: 'open', customElements: registry}); } } ``` @@ -107,7 +107,7 @@ The context node is the node that hosts the element creation API that was invoke #### 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. +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. Another option for looking up registries is to store an element's originating registry with the element. The Chrome DOM team was concerned about the small additional memory overhead on all elements. Looking up the root avoids this. @@ -119,6 +119,51 @@ 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. +## Interaction with Declarative Shadow DOM + +[Declarative shadow DOM](https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md) allows HTML to construct shadow roots for elements from `