Index: Source/core/dom/ContainerNode.cpp |
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp |
index 8c20d806aca347a6e5ae6344e7aec2aeadda5aa2..dec61172bc1d12b3b1666a6c89c0ce5a7531aab9 100644 |
--- a/Source/core/dom/ContainerNode.cpp |
+++ b/Source/core/dom/ContainerNode.cpp |
@@ -66,14 +66,15 @@ unsigned NoEventDispatchAssertion::s_count = 0; |
static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes, ExceptionState& exceptionState) |
{ |
- if (!node.isDocumentFragment()) { |
- nodes.append(&node); |
- if (ContainerNode* oldParent = node.parentNode()) |
- oldParent->removeChild(&node, exceptionState); |
+ if (node.isDocumentFragment()) { |
+ DocumentFragment& fragment = toDocumentFragment(node); |
+ getChildNodes(fragment, nodes); |
+ fragment.removeChildren(); |
return; |
} |
- getChildNodes(node, nodes); |
- toContainerNode(node).removeChildren(); |
+ nodes.append(&node); |
+ if (ContainerNode* oldParent = node.parentNode()) |
+ oldParent->removeChild(&node, exceptionState); |
} |
#if !ENABLE(OILPAN) |