Skip to content

Commit 307f1ad

Browse files
authored
Add an introduction for scoped custom element registries
1 parent b6dd913 commit 307f1ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

source

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73683,6 +73683,20 @@ console.log(plasticButton.outerHTML); // will output '<button is="plastic-but
7368373683
console.assert(outOfDocument instanceof ExampleElement);
7368473684
&lt;/script></code></pre>
7368573685

73686+
<h5>Scoped custom element registries</h5>
73687+
73688+
<p>To allow multiple libraries to co-exist without explicit coordination,
73689+
<code>CustomElementRegistry</code> can be used in a scoped fashion as well.</p>
73690+
73691+
<pre><code class="javascript">const scoped = new CustomElementRegistry();
73692+
scoped.define("example-element", ExampleElement);
73693+
73694+
const element = document.createElement("example-element", { customElementRegistry: scoped });</code></pre>
73695+
73696+
<p>A node with an associated scoped <code>CustomElementRegistry</code> will use that registry for
73697+
all its operations, such as when invoking <code
73698+
data-x="dom-Element-setHTMLUnsafe">setHTMLUnsafe()</code>.</p>
73699+
7368673700
<h5>Exposing custom element states</h5>
7368773701

7368873702
<p>Built-in elements provided by user agents have certain states that can change over time

0 commit comments

Comments
 (0)