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

Unified Diff: Source/core/editing/SplitElementCommand.cpp

Issue 183763033: Avoid calling hasAttribute() and then getAttribute() for performance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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 | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/html/HTMLAnchorElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SplitElementCommand.cpp
diff --git a/Source/core/editing/SplitElementCommand.cpp b/Source/core/editing/SplitElementCommand.cpp
index 128c37097edf83107af7d220dc03e76eaf48d020..02a2761812444d0cca8f7c7ecac733923fd87042 100644
--- a/Source/core/editing/SplitElementCommand.cpp
+++ b/Source/core/editing/SplitElementCommand.cpp
@@ -93,8 +93,9 @@ void SplitElementCommand::doUnapply()
m_element2->insertBefore(children[i].get(), refChild.get(), IGNORE_EXCEPTION);
// Recover the id attribute of the original element.
- if (m_element1->hasAttribute(HTMLNames::idAttr))
- m_element2->setAttribute(HTMLNames::idAttr, m_element1->getAttribute(HTMLNames::idAttr));
+ const AtomicString& id = m_element1->getAttribute(HTMLNames::idAttr);
+ if (!id.isNull())
+ m_element2->setAttribute(HTMLNames::idAttr, id);
m_element1->remove(IGNORE_EXCEPTION);
}
« no previous file with comments | « Source/core/editing/EditingStyle.cpp ('k') | Source/core/html/HTMLAnchorElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698