From 1f2d9b208d72b0461e2550c664c26728331d028e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Fri, 11 Mar 2016 10:22:24 -0800 Subject: [PATCH] Add nodes to DocumentFragments before attaching --- src/renderers/dom/client/utils/DOMLazyTree.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/renderers/dom/client/utils/DOMLazyTree.js b/src/renderers/dom/client/utils/DOMLazyTree.js index 28ae4b98ed9e1..520a06c5f976c 100644 --- a/src/renderers/dom/client/utils/DOMLazyTree.js +++ b/src/renderers/dom/client/utils/DOMLazyTree.js @@ -53,8 +53,16 @@ function insertTreeChildren(tree) { var insertTreeBefore = createMicrosoftUnsafeLocalFunction( function(parentNode, tree, referenceNode) { - parentNode.insertBefore(tree.node, referenceNode); - insertTreeChildren(tree); + // Document Fragments in IE11, Edge (and possibly others) won't update + // correctly if they are already inserted. So we have to break out of our + // lazy approach and append children to the fragment before inserting it. + if (tree.node.nodeType === 11) { + insertTreeChildren(tree); + parentNode.insertBefore(tree.node, referenceNode); + } else { + parentNode.insertBefore(tree.node, referenceNode); + insertTreeChildren(tree); + } } );