From 6fdc01201b1db8b0513754028f7e75ba6ac7c533 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 11 Sep 2018 17:39:43 +0300 Subject: [PATCH] FF: preserve sheet's disabled state in workaround for #461 --- content/apply.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/content/apply.js b/content/apply.js index c332fc11..ac0e03d3 100644 --- a/content/apply.js +++ b/content/apply.js @@ -333,11 +333,12 @@ (document.head || ROOT).appendChild(document.createElement('script')).text = ` document.currentScript.remove(); for (const {id, code} of ${JSON.stringify(pageContextQueue)}) { - ( - document.getElementById(id) || - document.querySelector('style.stylus[id="' + id + '"]') || - {} - ).textContent = code; + const el = document.getElementById(id) || + document.querySelector('style.stylus[id="' + id + '"]'); + if (!el) continue; + const {disabled} = el.sheet; + el.textContent = code; + el.sheet.disabled = disabled; } `; } catch (e) {}