diff lib/js/urweb.js @ 1811:9913c81bdbef

Fixed memory leak in dynClass
author Vladimir Shabanov <vshabanoff@gmail.com>
date Thu, 30 Aug 2012 17:00:18 +0400
parents d2383ffc18ab
children ea5f920ffa35
line wrap: on
line diff
--- a/lib/js/urweb.js	Wed Aug 22 08:46:32 2012 -0400
+++ b/lib/js/urweb.js	Thu Aug 30 17:00:18 2012 +0400
@@ -1104,27 +1104,28 @@
 	    x.closures = concat(cls.v, htmlCls);
         }
 
-        addNode(x);
+        html.appendChild(x);
         populate(x);
     }
 
     if (s_style) {
+        var htmlCls2 = s_class ? null : htmlCls;
         var x = document.createElement("script");
         x.dead = false;
         x.signal = s_style;
         x.sources = null;
-        x.closures = htmlCls;
+        x.closures = htmlCls2;
         
         x.recreate = function(v) {
-            for (var ls = x.closures; ls != htmlCls; ls = ls.next)
+            for (var ls = x.closures; ls != htmlCls2; ls = ls.next)
                 freeClosure(ls.data);
 
             var cls = {v : null};
             html.style.cssText = flatten(cls, v);
-	    x.closures = concat(cls.v, htmlCls);
+	    x.closures = concat(cls.v, htmlCls2);
         }
 
-        addNode(x);
+        html.appendChild(x);
         populate(x);
     }
 }