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

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: Address comments Created 6 years, 1 month 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
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/html/HTMLTitleElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/html/HTMLTitleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698