summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vladimir Shabanov <vshabanoff@gmail.com>2017-12-13 19:24:56 +0300
committerGravatar Vladimir Shabanov <vshabanoff@gmail.com>2017-12-13 19:24:56 +0300
commit5d6b1ac92263d41c32e896603b4fa3e1790c9d71 (patch)
tree8466838fe834af4a134abafce3f0737a34de5427
parenta707c42ce3773318f80ed78eea653a581639fdba (diff)
dynClass() now calculates and sets class and style attributes before adding node to DOM.
-rw-r--r--lib/js/urweb.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 1a275451..d8198ed0 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1286,11 +1286,12 @@ function dynClass(pnode, html, s_class, s_style) {
if (pnode == "table" && html.tagName == "TBODY") {
html = html.firstChild;
}
- addNode(html);
- runScripts(html);
+
+ var x = null;
+ var y = null;
if (s_class) {
- var x = document.createElement("script");
+ x = document.createElement("script");
x.dead = false;
x.signal = s_class;
x.sources = null;
@@ -1305,13 +1306,12 @@ function dynClass(pnode, html, s_class, s_style) {
x.closures = concat(cls.v, htmlCls);
}
- html.appendChild(x);
populate(x);
}
if (s_style) {
var htmlCls2 = s_class ? null : htmlCls;
- var y = document.createElement("script");
+ y = document.createElement("script");
y.dead = false;
y.signal = s_style;
y.sources = null;
@@ -1326,9 +1326,16 @@ function dynClass(pnode, html, s_class, s_style) {
y.closures = concat(cls.v, htmlCls2);
}
- html.appendChild(y);
populate(y);
}
+
+ addNode(html);
+ runScripts(html);
+
+ if (x)
+ html.appendChild(x);
+ if (y)
+ html.appendChild(y);
}
function bodyDynClass(s_class, s_style) {