Skip to content

Commit 554d512

Browse files
author
Victor Homyakov
committed
Prevent IE leaks
Without fix:  - when `ELEMENT_CACHE` is not empty (e.g. `SPAN` was created with `new Element('span'))`, IE will leak memory for `DIV` and `ELEMENT_CACHE` after page unload.  - when `ELEMENT_CACHE` is empty, `DIV` is cleaned correctly without any additional actions. Problem detected and fix tested in sIEve-0.0.8.
1 parent addd725 commit 554d512

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/prototype/dom/dom.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3468,5 +3468,15 @@
34683468
}
34693469

34703470
Element.addMethods(methods);
3471-
3471+
3472+
// Prevent IE leaks on DIV and ELEMENT_CACHE
3473+
DIV = null;
3474+
3475+
function destroyCache_IE() {
3476+
ELEMENT_CACHE = null;
3477+
}
3478+
3479+
if (window.attachEvent)
3480+
window.attachEvent('onunload', destroyCache_IE);
3481+
34723482
})(this);

0 commit comments

Comments
 (0)