Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap insertBefore in Windows 8 apps #6063

Merged
merged 1 commit into from
Feb 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/renderers/dom/client/utils/DOMChildrenOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @providesModule DOMChildrenOperations
*/

/* globals MSApp */

'use strict';

var DOMLazyTree = require('DOMLazyTree');
Expand All @@ -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) {
Expand Down
11 changes: 10 additions & 1 deletion src/renderers/dom/client/utils/DOMLazyTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* @providesModule DOMLazyTree
*/

/* globals MSApp */

'use strict';

var setTextContent = require('setTextContent');
Expand Down Expand Up @@ -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);
}

Expand Down