LibWeb: Be less aggressive in marking elements as not being named

When an element's ID is removed we only want to remove it from
`m_potentially_named_elements` if it is not also considered a
potentially named element due to it's name content attribute.
This commit is contained in:
Callum Law 2025-05-23 00:07:03 +12:00 committed by Jelle Raaijmakers
commit 64f09b520d
Notes: github-actions[bot] 2025-05-22 14:57:08 +00:00
3 changed files with 131 additions and 1 deletions

View file

@ -5440,7 +5440,7 @@ void Document::element_id_changed(Badge<DOM::Element>, GC::Ref<DOM::Element> ele
if (element->id().has_value())
insert_in_tree_order(m_potentially_named_elements, element);
else
else if (!element->name().has_value())
(void)m_potentially_named_elements.remove_first_matching([element](auto& e) { return e == element; });
auto new_id = element->id();