Index: Source/core/dom/Node.cpp |
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
index d14dfc63943404640a9af12e8b81ab5a7ad5a384..1b0a2d6997ec4c109f349592d6d6ee8cbef9c616 100644 |
--- a/Source/core/dom/Node.cpp |
+++ b/Source/core/dom/Node.cpp |
@@ -1401,11 +1401,14 @@ void Node::setTextContent(const String& text) |
return; |
ChildListMutationScope mutation(*this); |
- container->removeChildren(); |
// Note: This API will not insert empty text nodes: |
// http://dom.spec.whatwg.org/#dom-node-textcontent |
- if (!text.isEmpty()) |
+ if (text.isEmpty()) { |
+ container->removeChildren(DispatchSubtreeModifiedEvent); |
+ } else { |
+ container->removeChildren(OmitSubtreeModifiedEvent); |
container->appendChild(document().createTextNode(text), ASSERT_NO_EXCEPTION); |
+ } |
return; |
} |
case DOCUMENT_NODE: |