Index: Source/core/dom/Node.cpp |
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
index 60e09a205ed5da49f28b78bc9f696885e66f7f40..62bbf79145d2778196f3a4cb68ee5854b0c90d27 100644 |
--- a/Source/core/dom/Node.cpp |
+++ b/Source/core/dom/Node.cpp |
@@ -1401,10 +1401,11 @@ void Node::setTextContent(const String& text) |
return; |
ChildListMutationScope mutation(*this); |
- container->removeChildren(); |
+ bool emptyText = text.isEmpty(); |
+ container->removeChildren(emptyText); |
// Note: This API will not insert empty text nodes: |
// http://dom.spec.whatwg.org/#dom-node-textcontent |
- if (!text.isEmpty()) |
+ if (!emptyText) |
container->appendChild(document().createTextNode(text), ASSERT_NO_EXCEPTION); |
return; |
} |