fixing multiple instanciation if a selector list was used
This commit is contained in:
parent
ed14c69103
commit
d4d370d92c
2 changed files with 1 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@digicomp/now-and-later",
|
"name": "@digicomp/now-and-later",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "an easy API for DOM MutationObserver",
|
"description": "an easy API for DOM MutationObserver",
|
||||||
"main": "src/nowAndLater.js",
|
"main": "src/nowAndLater.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -40,11 +40,6 @@ const observer = new MutationObserver(function (mutationsList)
|
||||||
if (addedNode.matches(selector)) {
|
if (addedNode.matches(selector)) {
|
||||||
lateInit.callback(addedNode);
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue