summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2016-08-24 12:14:14 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2016-08-24 12:14:14 -0400
commit0b38f30883241b7dc45f8e2b8ff1a9c52a8b1536 (patch)
tree9a2cb328aa3c6e6c0ab6ddcd316184479b79c54e /lib
parent3bcc7ed859aecb758742b0cf23cae98214938012 (diff)
Plug a reactive-DOM memory leak (thanks to Saulo Araujo for spotting the problem and proposing a slightly different fix)
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 95fd6756..222a8322 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1100,12 +1100,18 @@ function active(s) {
function input(x, s, recreate, type, name) {
if (name) x.name = name;
if (type) x.type = type;
- x.dead = false;
- x.signal = ss(s);
- x.sources = null;
- x.recreate = recreate(x);
addNode(x);
- populate(x);
+
+ var sc = document.createElement("script");
+ sc.dead = false;
+ sc.signal = ss(s);
+ sc.sources = null;
+ sc.recreate = recreate(x);
+
+ if (x.parentNode)
+ x.parentNode.insertBefore(sc, x);
+
+ populate(sc);
return x;
}