From 93e7d9619a35e9a61b498938236573330c1b9621 Mon Sep 17 00:00:00 2001 From: wanhose Date: Tue, 19 Mar 2024 19:10:30 +0100 Subject: [PATCH] fix(browser-extension): not forcing styles --- .../browser-extension/src/scripts/content.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/browser-extension/src/scripts/content.js b/packages/browser-extension/src/scripts/content.js index b437061..394b08d 100644 --- a/packages/browser-extension/src/scripts/content.js +++ b/packages/browser-extension/src/scripts/content.js @@ -106,17 +106,15 @@ function forceClean(element) { */ function forceElementStyles(mutations, observer) { for (const mutation of mutations) { - if (mutation.type === 'attributes' && dataAttributeName === mutation.attributeName) { - const element = mutation.target; - const value = element.getAttribute(dataAttributeName); + const element = mutation.target; + const value = element.getAttribute(dataAttributeName); - if (value === null) { - observer.disconnect(); - element.removeAttribute(dataAttributeName); - element.style.removeProperty('display'); - } else { - element.style.setProperty('display', 'none', 'important'); - } + if (value === null) { + observer.disconnect(); + element.removeAttribute(dataAttributeName); + element.style.removeProperty('display'); + } else { + element.style.setProperty('display', 'none', 'important'); } } }