[Laszlo-checkins] r13798 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml

max@openlaszlo.org max at openlaszlo.org
Sat May 2 11:20:52 PDT 2009


Author: max
Date: 2009-05-02 11:20:51 -0700 (Sat, 02 May 2009)
New Revision: 13798

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
Log:
Change 20090501-maxcarlson-G by maxcarlson at Bank on 2009-05-01 18:32:10 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: IE-specific cleanup of text size div leak prevention code

Bugs Fixed: LPP-8016 - Performance differences between OL 4.0.x and 4.3.x

Technical Reviewer: ptw
QA Reviewer: hminsky

Details: This was done to make ptw happier.  It should be more efficient since IE likes arrays better than objects :)

Tests: All apps run as before.  IE 6 shows no leaks in the drip leak detector for webtop :)



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-05-02 12:37:39 UTC (rev 13797)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2009-05-02 18:20:51 UTC (rev 13798)
@@ -2271,12 +2271,7 @@
 
     // Make sure all references to code inside DIVs are cleaned up to prevent leaks in IE
     function __cleanUpForIE() {
-        var obj = LzTextSprite.prototype._sizedomcache;
-        var f = LzSprite.prototype.__discardElement;
-        for (var i in obj) {
-            f(obj[i]);
-        }
-        LzTextSprite.prototype._sizedomcache = {};
+        LzTextSprite.prototype.__cleanupdivs();
         LzTextSprite.prototype._sizecache = {};
 
         var obj = LzSprite.prototype.__sprites;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js	2009-05-02 12:37:39 UTC (rev 13797)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js	2009-05-02 18:20:51 UTC (rev 13798)
@@ -360,7 +360,16 @@
 
 LzTextSprite.prototype._sizecache = {counter: 0}
 if (LzSprite.prototype.quirks.ie_leak_prevention) {
-    LzTextSprite.prototype._sizedomcache = {}
+    LzTextSprite.prototype.__divstocleanup = [];
+    LzTextSprite.prototype.__cleanupdivs = function() {
+        var obj = LzTextSprite.prototype.__divstocleanup;
+        var func = LzSprite.prototype.__discardElement;
+        var l = obj.length;
+        for (var i = 0; i < l; i++) {
+            func( obj[i] ); 
+        }
+        LzTextSprite.prototype.__divstocleanup = []
+    }
 }
 
 // key is the div class plus local style
@@ -447,10 +456,7 @@
     _sizecache = {counter: 0};
     cv = null;
     if (LzSprite.prototype.quirks.ie_leak_prevention) {
-      var obj = ltsp._sizedomcache;
-      var f = LzSprite.prototype.__discardElement;
-      for (var i in obj) { f( obj[i] ); }
-      ltsp._sizedomcache = {}
+      LzTextSprite.prototype.__cleanupdivs();
     }
     if (root) { root.innerHTML = ''; }
   }
@@ -469,7 +475,7 @@
   // to conditionalize setting the text into the node (because there
   // seems to be no generic method for setting the content of nodes?)
   var tagname = 'div';
-  mdivKey = className + "/" + style + 'div';
+  var mdivKey = className + "/" + style + 'div';
   var mdiv = _sizecache[mdivKey];
   if (mdiv) {
     // reuse existing div
@@ -486,7 +492,7 @@
       root.insertAdjacentHTML('beforeEnd', html);
       var mdiv = document.all['testSpan' + ltsp._sizecache.counter];
       if (this.quirks.ie_leak_prevention) {
-        ltsp._sizedomcache['lzdiv~~~' + cacheFullKey] = mdiv;
+        ltsp.__divstocleanup.push(mdiv);
       }
     } else {
       var mdiv = document.createElement(tagname)



More information about the Laszlo-checkins mailing list