Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: Source/core/dom/Node.cpp

Issue 688933002: Make textContent trigger single DOMSubtreeModified event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698