Index: Source/core/rendering/RenderTreeAsText.cpp |
diff --git a/Source/core/rendering/RenderTreeAsText.cpp b/Source/core/rendering/RenderTreeAsText.cpp |
index 9544a0e622f2031ebe03b70f7d96da8405956436..3905d7bff748d71e5e8cf938d4d7f63a8299fdfc 100644 |
--- a/Source/core/rendering/RenderTreeAsText.cpp |
+++ b/Source/core/rendering/RenderTreeAsText.cpp |
@@ -348,17 +348,18 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, |
} |
if (behavior & RenderAsTextShowIDAndClass) { |
- if (Node* node = o.node()) { |
- if (node->hasID()) |
- ts << " id=\"" + toElement(node)->getIdAttribute() + "\""; |
+ Node* node = o.node(); |
+ if (node && node->isElementNode()) { |
+ Element& element = toElement(*node); |
+ if (element.hasID()) |
+ ts << " id=\"" + element.getIdAttribute() + "\""; |
- if (node->hasClass()) { |
+ if (element.hasClass()) { |
ts << " class=\""; |
- Element* element = toElement(node); |
- for (size_t i = 0; i < element->classNames().size(); ++i) { |
+ for (size_t i = 0; i < element.classNames().size(); ++i) { |
if (i > 0) |
ts << " "; |
- ts << element->classNames()[i]; |
+ ts << element.classNames()[i]; |
} |
ts << "\""; |
} |