1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:28:13 +00:00

LibWeb: Port named_item_value from DeprecatedFlyString

This commit is contained in:
Shannon Booth 2023-10-08 13:16:50 +13:00 committed by Tim Flynn
parent c7cd6f2bef
commit b37aab1277
19 changed files with 33 additions and 36 deletions

View file

@ -1481,7 +1481,7 @@ Vector<DeprecatedString> Window::supported_property_names()
}
// https://html.spec.whatwg.org/#named-access-on-the-window-object
WebIDL::ExceptionOr<JS::Value> Window::named_item_value(DeprecatedFlyString const& name)
WebIDL::ExceptionOr<JS::Value> Window::named_item_value(FlyString const& name)
{
// To determine the value of a named property name in a Window object window, the user agent must return the value obtained using the following steps:
@ -1515,9 +1515,9 @@ WebIDL::ExceptionOr<JS::Value> Window::named_item_value(DeprecatedFlyString cons
// whose filter matches only named objects of window with the name name. (By definition, these will all be elements.)
return DOM::HTMLCollection::create(associated_document(), DOM::HTMLCollection::Scope::Descendants, [name](auto& element) -> bool {
if ((is<HTMLEmbedElement>(element) || is<HTMLFormElement>(element) || is<HTMLImageElement>(element) || is<HTMLObjectElement>(element))
&& (element.attribute(AttributeNames::name) == name.view()))
&& (element.attribute(AttributeNames::name) == name))
return true;
return element.attribute(AttributeNames::id) == name.view();
return element.attribute(AttributeNames::id) == name;
});
}