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

LibWeb: Use Element::id() in Window::supported_property_names()

We already have the `id` attribute cached on elements, so we don't
need to walk the attribute list to find it.
This commit is contained in:
Andreas Kling 2023-12-24 14:53:15 +01:00
parent 75d5429d66
commit 0178929387

View file

@ -1554,7 +1554,7 @@ Vector<String> Window::supported_property_names()
// The supported property names of a Window object window at any moment consist of the following,
// in tree order according to the element that contributed them, ignoring later duplicates:
HashTable<String> property_names;
HashTable<FlyString> property_names;
// - window's document-tree child navigable target name property set;
auto child_navigable_property_set = document_tree_child_navigable_target_name_property_set();
@ -1570,15 +1570,15 @@ Vector<String> Window::supported_property_names()
if (auto const& name = element.attribute(AttributeNames::name); name.has_value())
property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
}
if (auto const& name = element.attribute(AttributeNames::id); name.has_value())
property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
if (auto const& name = element.id(); name.has_value())
property_names.set(name.value().to_string(), AK::HashSetExistingEntryBehavior::Keep);
return IterationDecision::Continue;
});
Vector<String> names;
names.ensure_capacity(property_names.size());
for (auto const& name : property_names) {
names.append(name);
names.append(name.to_string());
}
return names;