Skip to content

Commit

Permalink
Editorial: add a concept for Window's CustomElementRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Dec 16, 2024
1 parent aa1c505 commit 8cdecdd
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -12041,8 +12041,8 @@ console.assert(el.constructor === Element);</code></pre>
<span>overridden constructor steps</span>:</p>

<ol>
<li><p>Let <var>registry</var> be the <span>current global object</span>'s
<code>CustomElementRegistry</code> object.</p></li>
<li><p>Let <var>registry</var> be <span>current global object</span>'s <span
data-x="global-custom-element-registry">custom element registry</span>.</p></li>

<li>
<p>If <span>NewTarget</span> is equal to the <span>active function
Expand All @@ -12065,23 +12065,25 @@ document.createElement("bad-1"); // (2)</code></pre>
</li>

<li>
<p>Let <var>definition</var> be the entry in <var>registry</var> with <span
<p>Let <var>definition</var> be the item in <var>registry</var>'s <span>custom element
definition set</span> with <span
data-x="concept-custom-element-definition-constructor">constructor</span> equal to
<span>NewTarget</span>. If there is no such definition, then throw a <code>TypeError</code>.</p>
<span>NewTarget</span>. If there is no such item, then throw a <code>TypeError</code>.</p>

<p class="note">Since there can be no entry in <var>registry</var> with a <span
<p class="note">Since there can be no item in <var>registry</var>'s <span>custom element
definition set</span> with a <span
data-x="concept-custom-element-definition-constructor">constructor</span> of undefined, this
step also prevents HTML element constructors from being called as functions (since in that case
<span>NewTarget</span> will be undefined).</p>
</li>

<li><p>Let <var>is value</var> be null.</p></li>
<li><p>Let <var>isValue</var> be null.</p></li>

<li>
<p>If <var>definition</var>'s <span data-x="concept-custom-element-definition-local-name">local
name</span> is equal to <var>definition</var>'s <span
data-x="concept-custom-element-definition-name">name</span> (i.e., <var>definition</var> is for
an <span>autonomous custom element</span>), then:</p>
an <span>autonomous custom element</span>):</p>

<ol>
<li>
Expand Down Expand Up @@ -12130,15 +12132,15 @@ document.createElement("bad-1"); // (2)</code></pre>
</div>
</li>

<li><p>Set <var>is value</var> to <var>definition</var>'s <span
<li><p>Set <var>isValue</var> to <var>definition</var>'s <span
data-x="concept-custom-element-definition-name">name</span>.</p></li>
</ol>
</li>

<li>
<p>If <var>definition</var>'s <span
data-x="concept-custom-element-definition-construction-stack">construction stack</span> is
empty, then:</p>
empty:</p>

<ol>
<li><p>Let <var>element</var> be the result of <span data-x="internally create a new object
Expand Down Expand Up @@ -12167,7 +12169,7 @@ document.createElement("bad-1"); // (2)</code></pre>
element definition</span> to <var>definition</var>.</p></li>

<li><p>Set <var>element</var>'s <span data-x="concept-element-is-value"><code
data-x="">is</code> value</span> to <var>is value</var>.</p></li>
data-x="">is</code> value</span> to <var>isValue</var>.</p></li>

<li><p>Return <var>element</var>.</p></li>
</ol>
Expand Down Expand Up @@ -72625,7 +72627,7 @@ document.body.append(parent);
null, then return null.</p></li>

<li><p>Let <var>registry</var> be <var>document</var>'s <span>relevant global object</span>'s
<code>CustomElementRegistry</code> object.</p></li>
<span data-x="global-custom-element-registry">custom element registry</span>.</p></li>

<li><p>If <var>registry</var>'s <span>custom element definition set</span> <span data-x="list
contains">contains</span> an item with <span
Expand All @@ -72646,9 +72648,10 @@ document.body.append(parent);

<h4 id="custom-elements-api">The <code>CustomElementRegistry</code> interface</h4>

<p w-nodev>Each <code>Window</code> object is associated with a unique instance of a
<code>CustomElementRegistry</code> object, allocated when the <code>Window</code> object is
created.</p>
<p w-nodev>Each <code>Window</code> object has an associated <dfn
data-x="global-custom-element-registry">custom element registry</dfn> (a
<code>CustomElementRegistry</code> object). It is set to a new
<code>CustomElementRegistry</code> object when the <code>Window</code> object is created.</p>

<p class="note">Custom element registries are associated with <code>Window</code> objects, instead
of <code>Document</code> objects, since each <span>custom element constructor</span> inherits from
Expand Down

0 comments on commit 8cdecdd

Please sign in to comment.