From 6e2c4b8cf920b8dfc41338d120bf2e912b002a42 Mon Sep 17 00:00:00 2001 From: Luis Ball Date: Mon, 1 Mar 2021 16:10:29 -0500 Subject: [PATCH] fix: revert "refactor: favor directly modifying DOM attributes over setAttribute" This reverts part of commit 62c51dc09db1b8654011bdeff8b548fff0d2ca21. --- src/js/injectBaseStylesheet.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/js/injectBaseStylesheet.js b/src/js/injectBaseStylesheet.js index 63fee620..353dead7 100644 --- a/src/js/injectBaseStylesheet.js +++ b/src/js/injectBaseStylesheet.js @@ -57,11 +57,10 @@ export default function injectBaseStylesheet() { const styleEl = document.createElement("style"); styleEl.type = "text/css"; - styleEl.classList = "drift-base-styles"; + styleEl.classList.add("drift-base-styles"); - styleEl.textContent = RULES; - const head = document.head; + styleEl.appendChild(document.createTextNode(RULES)); - const allHeadElements = head.getElementsByTagName("*"); - allHeadElements.innerHTML = styleEl + allHeadElements.innerHTML; + const head = document.head; + head.insertBefore(styleEl, head.firstChild); }