1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +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;
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<HTML::HTMLTemplateElement>(node)) {
static_cast<DOM::ParentNode const&>(node).for_each_child([](auto& child) {
dump_tree(child);
static_cast<DOM::ParentNode const&>(node).for_each_child([&](auto& child) {
dump_tree(builder, child);
});
} else {
auto& template_element = verify_cast<HTML::HTMLTemplateElement>(node);
dump_tree(template_element.content());
dump_tree(builder, template_element.content());
}
}
--indent;