From e73d61c2df8c3c53bdb30dcfba996fea2e081acc Mon Sep 17 00:00:00 2001 From: Vladimir Shabanov Date: Thu, 30 Aug 2012 17:00:18 +0400 Subject: Fixed memory leak in dynClass --- lib/js/urweb.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/js') diff --git a/lib/js/urweb.js b/lib/js/urweb.js index a181bbf9..4645df51 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1104,27 +1104,28 @@ function dynClass(html, s_class, s_style) { 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); } } -- cgit v1.2.3