Add nodes to DocumentFragments before attaching

This commit is contained in:
Paul O’Shannessy
2016-03-11 11:02:34 -08:00
parent 68d6f2139b
commit a40752fb03
+10 -2
View File
@@ -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);
}
}
);