1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibWeb: Rename "for_each_in_subtree(_of_type)" to "for_each_in_inclusive_subtree(_of_type)"

This is because it includes the initial node that the function was
called on, which makes it "inclusive" as according to the spec.

This is important as there are non-inclusive variants, particularly
used in the node mutation algorithms.
This commit is contained in:
Luke 2021-04-06 18:38:10 +01:00 committed by Andreas Kling
parent f482628fe5
commit ca71ac484b
12 changed files with 29 additions and 29 deletions

View file

@ -350,7 +350,7 @@ NonnullRefPtrVector<Element> Element::get_elements_by_tag_name(const FlyString&
// FIXME: Support "*" for tag_name
// https://dom.spec.whatwg.org/#concept-getelementsbytagname
NonnullRefPtrVector<Element> elements;
for_each_in_subtree_of_type<Element>([&](auto& element) {
for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
if (element.namespace_() == Namespace::HTML
? element.local_name().to_lowercase() == tag_name.to_lowercase()
: element.local_name() == tag_name) {
@ -364,7 +364,7 @@ NonnullRefPtrVector<Element> Element::get_elements_by_tag_name(const FlyString&
NonnullRefPtrVector<Element> Element::get_elements_by_class_name(const FlyString& class_name) const
{
NonnullRefPtrVector<Element> elements;
for_each_in_subtree_of_type<Element>([&](auto& element) {
for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
if (element.has_class(class_name, m_document->in_quirks_mode() ? CaseSensitivity::CaseInsensitive : CaseSensitivity::CaseSensitive))
elements.append(element);
return IterationDecision::Continue;