mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:35:07 +00:00
LibWeb: Use cached element name and id where possible
Instead of looking up in the named node map, we can simply use the cached name and ID on the element.
This commit is contained in:
parent
41f84deb9f
commit
0695236408
11 changed files with 30 additions and 36 deletions
|
@ -118,12 +118,10 @@ Vector<FlyString> HTMLCollection::supported_property_names() const
|
|||
}
|
||||
|
||||
// 2. If element is in the HTML namespace and has a name attribute whose value is neither the empty string nor is in result, append element’s name attribute value to result.
|
||||
if (element->namespace_uri() == Namespace::HTML) {
|
||||
if (auto maybe_name = element->attribute(HTML::AttributeNames::name); maybe_name.has_value()) {
|
||||
auto name = maybe_name.release_value();
|
||||
if (!name.is_empty() && !result.contains_slow(name))
|
||||
result.append(name);
|
||||
}
|
||||
if (element->namespace_uri() == Namespace::HTML && element->name().has_value()) {
|
||||
auto name = element->name().value();
|
||||
if (!name.is_empty() && !result.contains_slow(name))
|
||||
result.append(move(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue