Skip to content

Commit 87b0aa6

Browse files
committed
Make custom element definition trigger in-document upgrades
This was part of the previous conclusion in WICG/webcomponents#419, but never got added back to the spec: - WICG/webcomponents@c4a829a removed all auto-upgrading - WICG/webcomponents@70b9d8d only added it back for when you insert an element into a document, not for when you define an element.
1 parent 3ac179e commit 87b0aa6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

source

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67655,7 +67655,7 @@ console.log(plasticButton2.getAttribute("is")); // will output "plastic-button"<
6765567655
<code>Window</code> object.</p>
6765667656

6765767657
<pre class="idl">interface <dfn>CustomElementsRegistry</dfn> {
67658-
void <span data-x="dom-CustomElementsRegistry-define">define</span>(DOMString name, Function constructor, optional ElementRegistrationOptions options);
67658+
[<span>CEReactions</span>] void <span data-x="dom-CustomElementsRegistry-define">define</span>(DOMString name, Function constructor, optional ElementRegistrationOptions options);
6765967659
any <span data-x="dom-CustomElementsRegistry-get">get</span>(DOMString name);
6766067660
[NewObject] Promise&lt;void&gt; <span data-x="dom-CustomElementsRegistry-whenDefined">whenDefined</span>(DOMString name);
6766167661
};
@@ -67811,6 +67811,22 @@ dictionary <dfn>ElementRegistrationOptions</dfn> {
6781167811

6781267812
<li><p>Add <var>definition</var> to this <code>CustomElementsRegistry</code>.</p></li>
6781367813

67814+
<li><p>Let <var>document</var> be this <code>CustomElementsRegistry</code>'s <span
67815+
data-x="concept-relevant-global">relevant global object</span>'s <span
67816+
data-x="concept-document-window"><code>Document</code> object</span>.</p></li>
67817+
67818+
<li><p>Let <var>upgrade candidates</var> be all elements in <var>document</var> whose namespace
67819+
is the <span>HTML namespace</span> and whose local name is <var>localName</var>, in tree
67820+
order. Additionally, if <var>extends</var> is non-null, only include elements that have an
67821+
attribute named <code data-x="attr-is">is</code> whose value is <var>name</var>.</p></li>
67822+
67823+
<li><p>For each element <var>element</var> in <var>upgrade candidates</var>, <span>enqueue a
67824+
custom element upgrade reaction</span> given <var>element</var> and
67825+
<var>definition</var>.</p></li>
67826+
67827+
<!-- It is equivalent to just try to upgrade all elements in the document, and let "try to
67828+
upgrade" bail out, but this seems a bit more explicit. -->
67829+
6781467830
<li>
6781567831
<p>If this <code>CustomElementsRegistry</code>'s <span>when-defined promise map</span>
6781667832
contains an entry with key <var>name</var>:</p>

0 commit comments

Comments
 (0)