mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Improve DOM dump formatting for HTML template elements
Let's dump both the template contents, and any DOM nodes inside the template element itself, since both are valid states produced by the HTML parser.
This commit is contained in:
parent
43eea9212d
commit
1102a31866
Notes:
github-actions[bot]
2025-04-25 09:02:16 +00:00
Author: https://github.com/awesomekling
Commit: 1102a31866
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4466
1 changed files with 12 additions and 9 deletions
|
@ -125,16 +125,19 @@ void dump_tree(StringBuilder& builder, DOM::Node const& node)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (is<HTML::HTMLTemplateElement>(node)) {
|
||||
auto& template_element = as<HTML::HTMLTemplateElement>(node);
|
||||
for (int i = 0; i < indent; ++i)
|
||||
builder.append(" "sv);
|
||||
builder.append("(template content)\n"sv);
|
||||
dump_tree(builder, template_element.content());
|
||||
builder.append("(template normal subtree)\n"sv);
|
||||
}
|
||||
if (is<DOM::ParentNode>(node)) {
|
||||
if (!is<HTML::HTMLTemplateElement>(node)) {
|
||||
static_cast<DOM::ParentNode const&>(node).for_each_child([&](auto& child) {
|
||||
dump_tree(builder, child);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
} else {
|
||||
auto& template_element = as<HTML::HTMLTemplateElement>(node);
|
||||
dump_tree(builder, template_element.content());
|
||||
}
|
||||
static_cast<DOM::ParentNode const&>(node).for_each_child([&](auto& child) {
|
||||
dump_tree(builder, child);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
--indent;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue