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

@ -76,8 +76,8 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable()
Optional<String> target_name;
// 5. If element has a name content attribute, then set targetName to the value of that attribute.
if (auto value = attribute(HTML::AttributeNames::name); value.has_value())
target_name = move(value);
if (name().has_value())
target_name = name().value().to_string();
// 6. Let documentState be a new document state, with
// - document: document