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

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

Issue 19045003: Element's insertAdjacent API should lazy attach (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index 5e03b35fc70f48acfdc487e6e5c3113fc929aef3..4089ef6bb2594e7813b54fc88d8c02c99a6d7992 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -494,9 +494,8 @@ Node* HTMLElement::insertAdjacent(const String& where, Node* newChild, Exception
// Opera also appears to disallow such usage.
if (equalIgnoringCase(where, "beforeBegin")) {
- ContainerNode* parent = this->parentNode();
- if (parent) {
- parent->insertBefore(newChild, this, ec);
+ if (ContainerNode* parent = this->parentNode()) {
+ parent->insertBefore(newChild, this, ec, AttachLazily);
if (!ec)
return newChild;
}
@@ -504,19 +503,18 @@ Node* HTMLElement::insertAdjacent(const String& where, Node* newChild, Exception
}
if (equalIgnoringCase(where, "afterBegin")) {
- insertBefore(newChild, firstChild(), ec);
+ insertBefore(newChild, firstChild(), ec, AttachLazily);
return ec ? 0 : newChild;
}
if (equalIgnoringCase(where, "beforeEnd")) {
- appendChild(newChild, ec);
+ appendChild(newChild, ec, AttachLazily);
return ec ? 0 : newChild;
}
if (equalIgnoringCase(where, "afterEnd")) {
- ContainerNode* parent = this->parentNode();
- if (parent) {
- parent->insertBefore(newChild, nextSibling(), ec);
+ if (ContainerNode* parent = this->parentNode()) {
+ parent->insertBefore(newChild, nextSibling(), ec, AttachLazily);
if (!ec)
return newChild;
}
@@ -537,7 +535,6 @@ Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi
}
Node* returnValue = insertAdjacent(where, newChild, ec);
- ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || returnValue->isElementNode());
ojan 2013/07/12 05:12:44 What's wrong with these asserts?
return toElement(returnValue);
}
@@ -550,7 +547,6 @@ static Element* contextElementForInsertion(const String& where, Element* element
ec = NoModificationAllowedError;
return 0;
}
- ASSERT_WITH_SECURITY_IMPLICATION(!parent || parent->isElementNode());
return toElement(parent);
}
if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd"))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698