UNPKG

react-native-web-internals

Version:

React Native for Web

15 lines (14 loc) 707 B
import canUseDOM from "../../modules/canUseDOM.mjs"; function createCSSStyleSheet(id, rootNode, textContent) { if (canUseDOM) { const root = rootNode ?? document; let element = root.getElementById(id); if (element == null) if (element = document.createElement("style"), element.setAttribute("id", id), typeof textContent == "string" && element.appendChild(document.createTextNode(textContent)), root instanceof ShadowRoot) root.insertBefore(element, root.firstChild);else { const head = root.head; head && head.appendChild(element); } return element.sheet; } else return null; } export { createCSSStyleSheet as default }; //# sourceMappingURL=createCSSStyleSheet.mjs.map