countStylesInHash when skipping styleReplaceAll

This commit is contained in:
tophf 2017-12-09 21:16:41 +03:00
parent e45748d515
commit 2fe4c0793c

View File

@ -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;