mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 05:21:18 +00:00
Prevent references to nodes swapped out of the dom accumulating as detached elements in memory (#2091)
* Prevent references to elements swapped out of the dom accumulating as detached nodes (memory leak). * Safely delete internal data when we tear down a node
This commit is contained in:
parent
4057f9c465
commit
9052a4d520
@ -961,10 +961,8 @@ return (function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (internalData.initHash) {
|
||||
internalData.initHash = null
|
||||
}
|
||||
deInitOnHandlers(element);
|
||||
forEach(Object.keys(internalData), function(key) { delete internalData[key] });
|
||||
}
|
||||
|
||||
function cleanUpElement(element) {
|
||||
@ -988,7 +986,6 @@ return (function () {
|
||||
} else {
|
||||
newElt = eltBeforeNewContent.nextSibling;
|
||||
}
|
||||
getInternalData(target).replacedWith = newElt; // tuck away so we can fire events on it later
|
||||
settleInfo.elts = settleInfo.elts.filter(function(e) { return e != target });
|
||||
while(newElt && newElt !== target) {
|
||||
if (newElt.nodeType === Node.ELEMENT_NODE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user