diff --git a/packages/react-dom-bindings/src/client/createMicrosoftUnsafeLocalFunction.js b/packages/react-dom-bindings/src/client/createMicrosoftUnsafeLocalFunction.js deleted file mode 100644 index 870d778422481..0000000000000 --- a/packages/react-dom-bindings/src/client/createMicrosoftUnsafeLocalFunction.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* globals MSApp */ - -/** - * Create a function which has 'unsafe' privileges (required by windows8 apps) - */ -function createMicrosoftUnsafeLocalFunction(func) { - if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { - return function (arg0, arg1, arg2, arg3) { - MSApp.execUnsafeLocalFunction(function () { - return func(arg0, arg1, arg2, arg3); - }); - }; - } else { - return func; - } -} - -export default createMicrosoftUnsafeLocalFunction; diff --git a/packages/react-dom-bindings/src/client/setInnerHTML.js b/packages/react-dom-bindings/src/client/setInnerHTML.js index f8a82fde34ef0..5f0d630fd38b5 100644 --- a/packages/react-dom-bindings/src/client/setInnerHTML.js +++ b/packages/react-dom-bindings/src/client/setInnerHTML.js @@ -7,24 +7,15 @@ * @flow */ +/* globals MSApp */ + import {SVG_NAMESPACE} from './DOMNamespaces'; -import createMicrosoftUnsafeLocalFunction from './createMicrosoftUnsafeLocalFunction'; import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags'; // SVG temp container for IE lacking innerHTML let reusableSVGContainer: HTMLElement; -/** - * Set the innerHTML property of a node - * - * @param {DOMElement} node - * @param {string} html - * @internal - */ -const setInnerHTML: ( - node: Element, - html: {valueOf(): {toString(): string, ...}, ...}, -) => void = createMicrosoftUnsafeLocalFunction(function ( +function setInnerHTMLImpl( node: Element, html: {valueOf(): {toString(): string, ...}, ...}, ): void { @@ -66,6 +57,26 @@ const setInnerHTML: ( } } node.innerHTML = (html: any); -}); +} + +let setInnerHTML: ( + node: Element, + html: {valueOf(): {toString(): string, ...}, ...}, +) => void = setInnerHTMLImpl; +// $FlowFixMe[cannot-resolve-name] +if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { + /** + * Create a function which has 'unsafe' privileges (required by windows8 apps) + */ + setInnerHTML = function ( + node: Element, + html: {valueOf(): {toString(): string, ...}, ...}, + ): void { + // $FlowFixMe[cannot-resolve-name] + return MSApp.execUnsafeLocalFunction(function () { + return setInnerHTMLImpl(node, html); + }); + }; +} export default setInnerHTML;