|
@@ -527,6 +527,25 @@ String Node::class_name() const
|
|
|
return demangle(typeid(*this).name());
|
|
|
}
|
|
|
|
|
|
+String Node::debug_description() const
|
|
|
+{
|
|
|
+ StringBuilder builder;
|
|
|
+ builder.append(class_name().substring_view(13));
|
|
|
+ if (dom_node()) {
|
|
|
+ builder.appendff("<{}>", dom_node()->node_name());
|
|
|
+ if (dom_node()->is_element()) {
|
|
|
+ auto& element = static_cast<DOM::Element const&>(*dom_node());
|
|
|
+ if (auto id = element.get_attribute(HTML::AttributeNames::id); !id.is_null())
|
|
|
+ builder.appendff("#{}", id);
|
|
|
+ for (auto const& class_name : element.class_names())
|
|
|
+ builder.appendff(".{}", class_name);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ builder.append("(anonymous)");
|
|
|
+ }
|
|
|
+ return builder.to_string();
|
|
|
+}
|
|
|
+
|
|
|
bool Node::is_inline_block() const
|
|
|
{
|
|
|
return is_inline() && is<BlockContainer>(*this);
|