From 2fe4c0793c5a90b8ed07fcbb2596263bcdfcd0c6 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 9 Dec 2017 21:16:41 +0300 Subject: [PATCH] countStylesInHash when skipping styleReplaceAll --- content/apply.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/apply.js b/content/apply.js index 6c78733d..21fa527b 100644 --- a/content/apply.js +++ b/content/apply.js @@ -316,6 +316,7 @@ function replaceAll(newStyles) { if ('disableAll' in newStyles && disableAll === newStyles.disableAll && + styleElements.size === countStylesInHash(newStyles) && [...styleElements.values()].every(el => el.disabled === disableAll && el.parentNode === ROOT && @@ -340,6 +341,14 @@ } + function countStylesInHash(styleHash) { + let num = 0; + for (const k in styleHash) { + num += !isNaN(parseInt(k)) ? 1 : 0; + } + return num; + } + function orphanCheck() { if (chrome.i18n && chrome.i18n.getUILanguage()) { return true;