aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@csail.mit.edu>2018-01-06 10:34:10 -0500
committerGravatar GitHub <noreply@github.com>2018-01-06 10:34:10 -0500
commit150df2983e01c5b4a5c561115471c3be5738bc84 (patch)
tree8466838fe834af4a134abafce3f0737a34de5427 /lib/js/urweb.js
parent8604afcbc37276760ae74b2d1fbe200aa4b64dce (diff)
parent5d6b1ac92263d41c32e896603b4fa3e1790c9d71 (diff)
Merge pull request #109 from vshabanov/master
Added oninput event and few more attributes
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r--lib/js/urweb.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index ebe192ca..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) {
@@ -1389,6 +1396,14 @@ function addOnChange(x, f) {
x.onchange = function() { old(); f(); };
}
+function addOnInput(x, f) {
+ var old = x.oninput;
+ if (old == null)
+ x.oninput = f;
+ else
+ x.oninput = function() { old(); f(); };
+}
+
function addOnKeyUp(x, f) {
var old = x.onkeyup;
if (old == null)