From 0def9c138e499e335fffc8b2428a2e1127d069ee Mon Sep 17 00:00:00 2001 From: Paul Esch-Laurent Date: Thu, 25 Jul 2024 16:37:01 -0500 Subject: [PATCH] fix: look for stylesheet ``s explicitly --- switcher.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/switcher.js b/switcher.js index 94ff07e..b3db25f 100644 --- a/switcher.js +++ b/switcher.js @@ -36,14 +36,13 @@ function inline_switcher() { } function add_switcher() { - css_link = document.getElementsByTagName("link")[0]; + css_link = document.querySelectorAll("link[rel='stylesheet']")[0]; if (css_link == undefined) { - head = document.getElementsByTagName('head')[0]; css_link = document.createElement('link'); css_link.rel="stylesheet"; css_link.type="text/css"; css_link.href="https://dohliam.github.io/dropin-minimal-css/min/" + frameworks.split(",")[0] + ".min.css"; - head.appendChild(css_link); + document.head.appendChild(css_link); } var new_div = document.createElement('div');