fix(browser-extension): not forcing styles

This commit is contained in:
wanhose 2024-03-19 19:10:30 +01:00
parent 55f3c51edf
commit 93e7d9619a

View File

@ -106,17 +106,15 @@ function forceClean(element) {
*/ */
function forceElementStyles(mutations, observer) { function forceElementStyles(mutations, observer) {
for (const mutation of mutations) { for (const mutation of mutations) {
if (mutation.type === 'attributes' && dataAttributeName === mutation.attributeName) { const element = mutation.target;
const element = mutation.target; const value = element.getAttribute(dataAttributeName);
const value = element.getAttribute(dataAttributeName);
if (value === null) { if (value === null) {
observer.disconnect(); observer.disconnect();
element.removeAttribute(dataAttributeName); element.removeAttribute(dataAttributeName);
element.style.removeProperty('display'); element.style.removeProperty('display');
} else { } else {
element.style.setProperty('display', 'none', 'important'); element.style.setProperty('display', 'none', 'important');
}
} }
} }
} }