Permalink
Browse files

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.
  • Loading branch information...
1 parent addd725 commit 554d512cc5bd61e2c2b5c233bc356945b199c411 @victor-homyakov victor-homyakov committed Sep 24, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/prototype/dom/dom.js
View
@@ -3468,5 +3468,15 @@
}
Element.addMethods(methods);
-
+
+ // Prevent IE leaks on DIV and ELEMENT_CACHE
+ DIV = null;
+
+ function destroyCache_IE() {
+ ELEMENT_CACHE = null;
+ }
+
+ if (window.attachEvent)
+ window.attachEvent('onunload', destroyCache_IE);
+
})(this);

0 comments on commit 554d512

Please sign in to comment.