summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jslib/urweb.js13
-rw-r--r--tests/ooo.ur8
-rw-r--r--tests/ooo.urp3
3 files changed, 22 insertions, 2 deletions
diff --git a/jslib/urweb.js b/jslib/urweb.js
index 0f9c06cf..8e39f9f3 100644
--- a/jslib/urweb.js
+++ b/jslib/urweb.js
@@ -34,17 +34,26 @@ function sb(x,y) {
return s;
}
+function myParent() {
+ var pos = document;
+
+ while (pos.lastChild && pos.lastChild.nodeType == 1)
+ pos = pos.lastChild;
+
+ return pos.parentNode;
+}
+
function dyn(s) {
var x = document.createElement("span");
x.innerHTML = s.v;
- document.body.appendChild(x);
+ myParent().appendChild(x);
s.h = cons(function() { x.innerHTML = s.v }, s.h);
}
function inp(t, s) {
var x = document.createElement(t);
x.value = s.v;
- document.body.appendChild(x);
+ myParent().appendChild(x);
s.h = cons(function() { x.value = s.v }, s.h);
x.onkeyup = function() { sv(s, x.value) };
}
diff --git a/tests/ooo.ur b/tests/ooo.ur
new file mode 100644
index 00000000..5401fa70
--- /dev/null
+++ b/tests/ooo.ur
@@ -0,0 +1,8 @@
+fun main () : transaction page =
+ s <- source "Hi";
+ return <xml><body>
+ <form>
+ <textbox{#A} source={s}/>
+ Change it up!
+ </form>
+ </body></xml>
diff --git a/tests/ooo.urp b/tests/ooo.urp
new file mode 100644
index 00000000..5a510107
--- /dev/null
+++ b/tests/ooo.urp
@@ -0,0 +1,3 @@
+debug
+
+ooo