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:
Shannon Booth 2024-01-13 20:12:25 +13:00 committed by Andreas Kling
parent 41f84deb9f
commit 0695236408
Notes: sideshowbarker 2024-07-18 22:57:59 +09:00
11 changed files with 30 additions and 36 deletions

View file

@ -54,9 +54,8 @@ void HTMLMetaElement::inserted()
// * The element is in a document tree
// * The element has a name attribute, whose value is an ASCII case-insensitive match for theme-color
// * The element has a content attribute
auto name = attribute(AttributeNames::name);
auto content = attribute(AttributeNames::content);
if (name.has_value() && name->bytes_as_string_view().equals_ignoring_ascii_case("theme-color"sv) && content.has_value()) {
if (name().has_value() && name()->equals_ignoring_ascii_case("theme-color"sv) && content.has_value()) {
auto context = CSS::Parser::ParsingContext { document() };
// 2. For each element in candidate elements: