From 0dbf8f072f628c884c09013090268def12c23798 Mon Sep 17 00:00:00 2001 From: Melloware Date: Sun, 7 Jan 2024 08:03:08 -0500 Subject: [PATCH] Minor fix to createInlineStyle --- components/lib/utils/DomHandler.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;