mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 12:47:41 +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:
parent
75d5429d66
commit
0178929387
1 changed files with 4 additions and 4 deletions
|
@ -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,
|
// 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:
|
// 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;
|
// - window's document-tree child navigable target name property set;
|
||||||
auto child_navigable_property_set = 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())
|
if (auto const& name = element.attribute(AttributeNames::name); name.has_value())
|
||||||
property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
|
property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
|
||||||
}
|
}
|
||||||
if (auto const& name = element.attribute(AttributeNames::id); name.has_value())
|
if (auto const& name = element.id(); name.has_value())
|
||||||
property_names.set(name.value(), AK::HashSetExistingEntryBehavior::Keep);
|
property_names.set(name.value().to_string(), AK::HashSetExistingEntryBehavior::Keep);
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
|
||||||
Vector<String> names;
|
Vector<String> names;
|
||||||
names.ensure_capacity(property_names.size());
|
names.ensure_capacity(property_names.size());
|
||||||
for (auto const& name : property_names) {
|
for (auto const& name : property_names) {
|
||||||
names.append(name);
|
names.append(name.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue