LibWeb: Don't match the root node of HTMLCollection
Every user of HTMLCollection does not expect the root node to be a
potential match, so let's avoid it by using non-inclusive sub-tree
traversal. This avoids matching the element that getElementsByTagName
was called on for example, which is required by Ruffle:
da689b7687/web/packages/core/src/ruffle-object.ts (L321-L329)
This commit is contained in:
parent
f80c05424e
commit
2125464b76
Notes:
sideshowbarker
2024-07-17 02:55:44 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/2125464b76 Pull-request: https://github.com/SerenityOS/serenity/pull/18349 Reviewed-by: https://github.com/linusg
1 changed files with 1 additions and 1 deletions
|
@ -44,7 +44,7 @@ void HTMLCollection::visit_edges(Cell::Visitor& visitor)
|
|||
JS::MarkedVector<Element*> HTMLCollection::collect_matching_elements() const
|
||||
{
|
||||
JS::MarkedVector<Element*> elements(m_root->heap());
|
||||
m_root->for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
|
||||
m_root->for_each_in_subtree_of_type<Element>([&](auto& element) {
|
||||
if (m_filter(element))
|
||||
elements.append(const_cast<Element*>(&element));
|
||||
return IterationDecision::Continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue