fixing multiple instanciation if a selector list was used

This commit is contained in:
Ferdinand Kuhl 2024-06-27 19:24:14 +02:00
parent ed14c69103
commit d4d370d92c
2 changed files with 1 additions and 6 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@digicomp/now-and-later",
"version": "1.0.1",
"version": "1.0.2",
"description": "an easy API for DOM MutationObserver",
"main": "src/nowAndLater.js",
"scripts": {

View file

@ -40,11 +40,6 @@ const observer = new MutationObserver(function (mutationsList)
if (addedNode.matches(selector)) {
lateInit.callback(addedNode);
}
// NOTE: the added not selector prevents double calls
const nodes = addedNode.querySelectorAll(selector);
if (nodes.length > 0) {
[...nodes].forEach(node => lateInit.callback(node));
}
}
}
}