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; |
} |