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> {