@samitouri / QOS-React-2 / commits / 2af4765a2a

DOMLazyTree, populate <object> before insertion into DOM (#6691)

Andreas Svensson committed May 6, 2016 at 00:12 UTC 2af4765a2af0d4de81d2f23f702d9d39d8917a0b
1 file changed +14 -2
src/renderers/dom/client/utils/DOMLazyTree.js
+14 -2
@@ -11,9 +11,14 @@
11
12 'use strict';
13
14 +var DOMNamespaces = require('DOMNamespaces');
15 +
16 var createMicrosoftUnsafeLocalFunction = require('createMicrosoftUnsafeLocalFunction');
17 var setTextContent = require('setTextContent');
18
19 +var ELEMENT_NODE_TYPE = 1;
20 +var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
21 +
22 /**
23 * In IE (8-11) and Edge, appending nodes with no children is dramatically
24 * faster than appending a full subtree, so we essentially queue up the
@@ -56,8 +61,15 @@ var insertTreeBefore = createMicrosoftUnsafeLocalFunction(
61 // DocumentFragments aren't actually part of the DOM after insertion so
62 // appending children won't update the DOM. We need to ensure the fragment
63 // is properly populated first, breaking out of our lazy approach for just
59 - // this level.
60 - if (tree.node.nodeType === 11) {
64 + // this level. Also, some <object> plugins (like Flash Player) will read
65 + // <param> nodes immediately upon insertion into the DOM, so <object>
66 + // must also be populated prior to insertion into the DOM.
67 + if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE
68 + ||
69 + tree.node.nodeType === ELEMENT_NODE_TYPE &&
70 + tree.node.nodeName.toLowerCase() === 'object' &&
71 + (tree.node.namespaceURI == null ||
72 + tree.node.namespaceURI === DOMNamespaces.html)) {
73 insertTreeChildren(tree);
74 parentNode.insertBefore(tree.node, referenceNode);
75 } else {