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

Unified Diff: Source/core/html/HTMLTitleElement.cpp

Issue 143363002: Don't create an empty text node when setting document.title to the empty string (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix indentation in test Created 6 years, 11 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
« no previous file with comments | « LayoutTests/fast/dom/document-set-title-no-child-on-empty-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTitleElement.cpp
diff --git a/Source/core/html/HTMLTitleElement.cpp b/Source/core/html/HTMLTitleElement.cpp
index ff62d1c92a0824c76b4ba392ea626248a62fec5d..ed8a83c45a751814f561022de43b43aebfdb2a6e 100644
--- a/Source/core/html/HTMLTitleElement.cpp
+++ b/Source/core/html/HTMLTitleElement.cpp
@@ -89,11 +89,12 @@ void HTMLTitleElement::setText(const String &value)
ChildListMutationScope mutation(*this);
// Avoid calling Document::setTitleElement() during intermediate steps.
- m_ignoreTitleUpdatesWhenChildrenChange = true;
+ m_ignoreTitleUpdatesWhenChildrenChange = !value.isEmpty();
removeChildren();
m_ignoreTitleUpdatesWhenChildrenChange = false;
- appendChild(document().createTextNode(value.impl()), IGNORE_EXCEPTION);
+ if (!value.isEmpty())
+ appendChild(document().createTextNode(value.impl()), IGNORE_EXCEPTION);
}
}
« no previous file with comments | « LayoutTests/fast/dom/document-set-title-no-child-on-empty-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698