1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 12:15:09 +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:
Shannon Booth 2024-01-13 20:12:25 +13:00 committed by Andreas Kling
parent 41f84deb9f
commit 0695236408
11 changed files with 30 additions and 36 deletions

View file

@ -104,7 +104,7 @@ void FormAssociatedElement::reset_form_owner()
// 1. If the first element in element's tree, in tree order, to have an ID that is identical to element's form content attribute's value, is a form element, then associate the element with that form element.
auto form_value = html_element.attribute(HTML::AttributeNames::form);
html_element.root().for_each_in_inclusive_subtree_of_type<HTMLFormElement>([this, &form_value](HTMLFormElement& form_element) {
if (form_element.attribute(HTML::AttributeNames::id) == form_value) {
if (form_element.id() == form_value) {
set_form(&form_element);
return IterationDecision::Break;
}