#1480 MutationObserver FIX

This commit is contained in:
Greg Zajac 2024-01-29 18:51:39 +01:00
parent e6426f8ae7
commit da68d752e3
2 changed files with 6 additions and 10 deletions

View File

@ -22,6 +22,7 @@ const notObservedNodes = [
'path',
'body',
'head',
'link',
'style',
'script',
'title',

View File

@ -30,17 +30,14 @@ const addedNodes = (mutation, tabData) => {
let newInputs = false;
let inputs = [];
const addedNodes = Array.from(mutation?.addedNodes);
const addedNodes = Array.from(mutation?.addedNodes).filter(node => !notObservedNodes.includes(node.nodeName.toLowerCase()));
if (!addedNodes || addedNodes.length <= 0) {
return false;
}
for (const node in addedNodes) {
if (notObservedNodes.includes(addedNodes[node].nodeName.toLowerCase())) {
break;
}
if (findSignificantChanges(addedNodes[node])) {
newInputs = true;
}
@ -48,15 +45,13 @@ const addedNodes = (mutation, tabData) => {
if (!newInputs) {
for (const node in addedNodes) {
if (notObservedNodes.includes(addedNodes[node].nodeName.toLowerCase())) {
break;
}
inputs.concat(getInputs(addedNodes[node]));
inputs.push(...getInputs(addedNodes[node]));
}
inputs = inputs.filter(node => !node.hasAttribute('data-twofas-input'));
newInputs = inputs.length > 0;
} else {
inputs = getInputs();
}
if (newInputs) {