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

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

Issue 779173002: Be more strict about multiple documentElements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Do the c -> child rename Created 6 years 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/inspector-support/uncaught-dom3-exception-expected.txt ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 84f313231a43233e5e35d4e1b4f7d396b4e287a9..78f305711ca43c989daf1cfc2d3c5103f13bab13 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -152,13 +152,10 @@ bool ContainerNode::checkAcceptChild(const Node* newChild, const Node* oldChild,
return false;
}
- if (oldChild && isDocumentNode()) {
- if (!toDocument(this)->canReplaceChild(*newChild, *oldChild)) {
- // FIXME: Adjust 'Document::canReplaceChild' to return some additional detail (or an error message).
- exceptionState.throwDOMException(HierarchyRequestError, "Failed to replace child.");
- return false;
- }
- } else if (!isChildTypeAllowed(*newChild)) {
+ if (isDocumentNode())
+ return toDocument(this)->canAcceptChild(*newChild, oldChild, exceptionState);
+
+ if (!isChildTypeAllowed(*newChild)) {
exceptionState.throwDOMException(HierarchyRequestError, "Nodes of type '" + newChild->nodeName() + "' may not be inserted inside nodes of type '" + nodeName() + "'.");
return false;
}
« no previous file with comments | « LayoutTests/fast/inspector-support/uncaught-dom3-exception-expected.txt ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698