1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:27:45 +00:00

LibWeb: Fix out-of-order DOM tree dumps

There were a few calls to the standalone version of dump_tree() inside
the recursive version of dump_tree(), which led to the output getting
jumbled out of order.
This commit is contained in:
Andreas Kling 2021-09-12 12:58:17 +02:00
parent 678dd2d180
commit f58f58fb77

View file

@ -52,16 +52,16 @@ void dump_tree(StringBuilder& builder, DOM::Node const& node)
} }
++indent; ++indent;
if (is<DOM::Element>(node) && verify_cast<DOM::Element>(node).shadow_root()) { if (is<DOM::Element>(node) && verify_cast<DOM::Element>(node).shadow_root()) {
dump_tree(*verify_cast<DOM::Element>(node).shadow_root()); dump_tree(builder, *verify_cast<DOM::Element>(node).shadow_root());
} }
if (is<DOM::ParentNode>(node)) { if (is<DOM::ParentNode>(node)) {
if (!is<HTML::HTMLTemplateElement>(node)) { if (!is<HTML::HTMLTemplateElement>(node)) {
static_cast<DOM::ParentNode const&>(node).for_each_child([](auto& child) { static_cast<DOM::ParentNode const&>(node).for_each_child([&](auto& child) {
dump_tree(child); dump_tree(builder, child);
}); });
} else { } else {
auto& template_element = verify_cast<HTML::HTMLTemplateElement>(node); auto& template_element = verify_cast<HTML::HTMLTemplateElement>(node);
dump_tree(template_element.content()); dump_tree(builder, template_element.content());
} }
} }
--indent; --indent;