Add customElements.getName (#32715)

* Add customElements.getName

* rebaseline
This commit is contained in:
Keith Cirkel 2024-07-07 16:22:57 +01:00 committed by GitHub
parent 816359583c
commit db4cba4d6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 15 deletions

View file

@ -561,6 +561,16 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
}
}
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-getname>
fn GetName(&self, constructor: Rc<CustomElementConstructor>) -> Option<DOMString> {
self.definitions
.borrow()
.0
.values()
.find(|definition| definition.constructor == constructor)
.map(|definition| DOMString::from(definition.name.to_string()))
}
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-whendefined>
#[allow(unsafe_code)]
fn WhenDefined(&self, name: DOMString, comp: InRealm) -> Rc<Promise> {

View file

@ -14,6 +14,8 @@ interface CustomElementRegistry {
any get(DOMString name);
DOMString? getName(CustomElementConstructor constructor);
Promise<CustomElementConstructor> whenDefined(DOMString name);
[CEReactions] undefined upgrade(Node root);

View file

@ -1610,9 +1610,6 @@
[VisibilityStateEntry interface: attribute duration]
expected: FAIL
[CustomElementRegistry interface: operation getName(CustomElementConstructor)]
expected: FAIL
[Navigation interface: existence and properties of interface object]
expected: FAIL

View file

@ -1,9 +0,0 @@
[CustomElementRegistry-getName.html]
[customElements.getName must return null when the registry does not contain an entry with the given constructor]
expected: FAIL
[customElements.getName returns the name of the entry with the given constructor when there is a matching entry.]
expected: FAIL
[customElements.getName returns the name of the entry with the given customized built in constructor when there is a matching entry.]
expected: FAIL

View file

@ -1490,9 +1490,6 @@
[ImageBitmap interface: attribute height]
expected: FAIL
[CustomElementRegistry interface: operation getName(CustomElementConstructor)]
expected: FAIL
[Navigation interface: existence and properties of interface object]
expected: FAIL