Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customElements.getName(constructor) #9195

Merged
merged 8 commits into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -70569,6 +70569,7 @@ document.body.append(parent);
interface <dfn interface>CustomElementRegistry</dfn> {
[<span>CEReactions</span>] undefined <span data-x="dom-CustomElementRegistry-define">define</span>(DOMString name, <span>CustomElementConstructor</span> constructor, optional <span>ElementDefinitionOptions</span> options = {});
(<span>CustomElementConstructor</span> or undefined) <span data-x="dom-CustomElementRegistry-get">get</span>(DOMString name);
DOMString? <span data-x="dom-CustomElementRegistry-getName">getName</span>(CustomElementConstructor constructor);
keithamus marked this conversation as resolved.
Show resolved Hide resolved
Promise&lt;<span>CustomElementConstructor</span>&gt; <span data-x="dom-CustomElementRegistry-whenDefined">whenDefined</span>(DOMString name);
[<span>CEReactions</span>] undefined <span data-x="dom-CustomElementRegistry-upgrade">upgrade</span>(<span>Node</span> root);
};
Expand Down Expand Up @@ -70601,8 +70602,8 @@ dictionary <dfn dictionary>ElementDefinitionOptions</dfn> {
<dt><code data-x=""><var>window</var>.<span data-x="dom-window-customElements">customElements</span>.<span subdfn data-x="dom-CustomElementRegistry-define">define</span>(<var>name</var>,
<var>constructor</var>)</code></dt>

<dd>Defines a new <span>custom element</span>, mapping the given name to the given constructor as
an <span>autonomous custom element</span>.</dd>
<dd>Defines a new <span>custom element</span>, mapping the given name to the given constructor
as an <span>autonomous custom element</span>.</dd>


<dt><code data-x=""><var>window</var>.<span data-x="dom-window-customElements">customElements</span>.<span data-x="dom-CustomElementRegistry-define">define</span>(<var>name</var>, <var>constructor</var>,
Expand All @@ -70619,6 +70620,11 @@ dictionary <dfn dictionary>ElementDefinitionOptions</dfn> {
<dd>Retrieves the <span>custom element constructor</span> defined for the given <span data-x="concept-custom-element-definition-name">name</span>. Returns undefined if there is no
<span>custom element definition</span> with the given <span data-x="concept-custom-element-definition-name">name</span>.</dd>

<dt><code data-x=""><var>window</var>.<span data-x="dom-window-customElements">customElements</span>.<span subdfn data-x="dom-CustomElementRegistry-getName">getName</span>(<var>constructor</var>)</code></dt>

<dd>Retrieves the given name for a <span>custom element</span> defined for the given <span data-x="concept-custom-element-definition-constructor">constructor</span>. Returns null if there is no
<span>custom element definition</span> with the given <span data-x="concept-custom-element-definition-constructor">constructor</span>.</dd>

<dt><code data-x=""><var>window</var>.<span data-x="dom-window-customElements">customElements</span>.<span subdfn data-x="dom-CustomElementRegistry-whenDefined">whenDefined</span>(<var>name</var>)</code></dt>

<dd>Returns a promise that will be fulfilled with the <span>custom element</span>'s constructor
Expand Down Expand Up @@ -70858,6 +70864,19 @@ dictionary <dfn dictionary>ElementDefinitionOptions</dfn> {
<li><p>Otherwise, return undefined.</p></li>
</ol>

<p>The <dfn method for="CustomElementRegistry"><code
data-x="dom-CustomElementRegistry-getName">getName(<var>constructor</var>)</code></dfn> method
keithamus marked this conversation as resolved.
Show resolved Hide resolved
steps are:</p>

<ol>
<li><p>If this <code>CustomElementRegistry</code> contains an entry with <span
data-x="concept-custom-element-definition-constructor">constructor</span>
<var>constructor</var>, then return that entry's <span
data-x="concept-custom-element-definition-name">name</span>.</p></li>

keithamus marked this conversation as resolved.
Show resolved Hide resolved
<li><p>Return null.</p></li>
</ol>

<p>When invoked, the <dfn method for="CustomElementRegistry"><code
data-x="dom-CustomElementRegistry-whenDefined">whenDefined(<var>name</var>)</code></dfn> method
must run these steps:</p>
Expand Down Expand Up @@ -134363,6 +134382,7 @@ INSERT INTERFACES HERE
葛依寧 (Kat Hackett),
Kathy Walton,
河童エクマ(Kawarabe Ecma)<!-- heppokofrontend on GitHub -->
Keith Cirkel, <!-- keithamus on GitHub -->
Keith Rollin,
Keith Yeung,
Kelly Ford,
Expand Down