From ac26b2b3308ecd9acda56ac99ddb48cc5e4dedf1 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Tue, 29 Dec 2020 17:07:33 +0100 Subject: [PATCH] #48 Several optimizations for font color enhancements --- src/javascript/enhancements/fontColor.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/javascript/enhancements/fontColor.ts b/src/javascript/enhancements/fontColor.ts index f01435b..9938169 100644 --- a/src/javascript/enhancements/fontColor.ts +++ b/src/javascript/enhancements/fontColor.ts @@ -54,8 +54,7 @@ function tryRegisterObserverForBadge(badge: Node): void { mutations.forEach(mutation => { // prevent recursive calls when our class is added / removed if (mutation.target instanceof Element) { - // TODO: Validate if that still works - if ((mutation.oldValue?.indexOf(DARKCOLOR_CLASS) ?? -1 ^ (mutation.target?.classList?.contains(DARKCOLOR_CLASS) ?? false ? 0 : -1)) === 0) { + if ((mutation.oldValue?.indexOf(DARKCOLOR_CLASS) >= 0 ?? false) !== (mutation.target?.classList?.contains(DARKCOLOR_CLASS) ?? false)) { return; } else {