Wrap insertBefore in Windows 8 apps

This commit is contained in:
Andreww8xx8
2016-02-18 06:12:29 +03:00
parent 12f5f556ec
commit d808cf6422
2 changed files with 20 additions and 2 deletions
@@ -9,6 +9,8 @@
* @providesModule DOMChildrenOperations
*/
/* globals MSApp */
'use strict';
var DOMLazyTree = require('DOMLazyTree');
@@ -35,7 +37,14 @@ function insertChildAt(parentNode, childNode, referenceNode) {
// We rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. (Using `undefined` is not allowed by all browsers so
// we are careful to use `null`.)
parentNode.insertBefore(childNode, referenceNode);
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
MSApp.execUnsafeLocalFunction(function() {
parentNode.insertBefore(childNode, referenceNode);
});
} else {
parentNode.insertBefore(childNode, referenceNode);
}
}
function insertLazyTreeChildAt(parentNode, childTree, referenceNode) {
+10 -1
View File
@@ -9,6 +9,8 @@
* @providesModule DOMLazyTree
*/
/* globals MSApp */
'use strict';
var setTextContent = require('setTextContent');
@@ -51,7 +53,14 @@ function insertTreeChildren(tree) {
}
function insertTreeBefore(parentNode, tree, referenceNode) {
parentNode.insertBefore(tree.node, referenceNode);
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
MSApp.execUnsafeLocalFunction(function() {
parentNode.insertBefore(tree.node, referenceNode);
});
} else {
parentNode.insertBefore(tree.node, referenceNode);
}
insertTreeChildren(tree);
}