Index: Source/core/dom/ContainerNode.cpp |
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp |
index 1c46d51413199c8ad2d3c3974aa7b102cd3afeb1..070befc354fafaac6d3c7ca80832b99221d00764 100644 |
--- a/Source/core/dom/ContainerNode.cpp |
+++ b/Source/core/dom/ContainerNode.cpp |
@@ -314,6 +314,9 @@ void ContainerNode::parserInsertBefore(PassRefPtrWillBeRawPtr<Node> newChild, No |
while (RefPtrWillBeRawPtr<ContainerNode> parent = newChild->parentNode()) |
parent->parserRemoveChild(*newChild); |
+ if (nextChild.parentNode() != this) |
+ return; |
+ |
if (document() != newChild->document()) |
document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); |