diff --git a/components/lib/utils/DomHandler.js b/components/lib/utils/DomHandler.js index 9f53dc549b..e26e14ffdd 100644 --- a/components/lib/utils/DomHandler.js +++ b/components/lib/utils/DomHandler.js @@ -1067,10 +1067,15 @@ export default class DomHandler { return false; } - static createInlineStyle(nonce, styleContainer = document.head) { + static createInlineStyle(nonce, styleContainer) { let styleElement = document.createElement('style'); DomHandler.addNonce(styleElement, nonce); + + if (!styleContainer) { + styleContainer = document.head; + } + styleContainer.appendChild(styleElement); return styleElement;