Skip to content

Commit

Permalink
fix leaked proxies; see choojs/nanocomponent#65
Browse files Browse the repository at this point in the history
  • Loading branch information
bennlich committed Dec 7, 2023
1 parent f74b0c5 commit 2fee534
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ function updateChildren (newNode, oldNode) {
}
}
}

replaceLeakedProxies(oldNode);
}

function replaceLeakedProxies(node) {
// leaked proxy fix (see: https://github.com/choojs/nanocomponent/issues/65)
if (!node.querySelectorAll) {
return;
}
let leakedProxies = node.querySelectorAll('[data-proxy]');
for (let proxy of leakedProxies) {
proxy.replaceWith(proxy.realNode);
}
}

function same (a, b) {
Expand Down

0 comments on commit 2fee534

Please sign in to comment.