From b011d206cfa0a176f2e66e6dd1aa00c502db8f3c Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 20 Aug 2017 14:24:50 +0300 Subject: [PATCH] make disableAll mode more reliable in popup fixes #159 --- content/apply.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/apply.js b/content/apply.js index 155458f5..f29b6e4a 100644 --- a/content/apply.js +++ b/content/apply.js @@ -245,7 +245,9 @@ function applySections(styleId, sections) { function addStyleElement(el) { if (ROOT && !document.getElementById(el.id)) { ROOT.appendChild(el); - el.disabled = disableAll; + if (disableAll) { + el.disabled = true; + } } } @@ -314,6 +316,10 @@ function initDocRootObserver() { for (const el of styleElements.values()) { if (el.previousElementSibling !== expectedPrevSibling) { ROOT.insertBefore(el, expectedPrevSibling.nextSibling); + if (el.disabled !== disableAll) { + // moving an element resets its 'disabled' state + el.disabled = disableAll; + } } expectedPrevSibling = el; }