summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js19
-rw-r--r--src/monoize.sml14
-rw-r--r--tests/dcol.ur8
-rw-r--r--tests/dcol.urp3
-rw-r--r--tests/dcol.urs1
5 files changed, 37 insertions, 8 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 84dcd7e2..57ad5454 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -302,8 +302,6 @@ function dyn(pnode, s) {
var dummy = document.createElement("body");
dummy.innerHTML = "<table>" + html + "</table>";
runScripts(dummy);
- var rows = dummy.firstChild.rows;
- var nRows = rows.length;
var table = x.parentNode;
var arr = dummy.getElementsByTagName("tbody");
@@ -317,6 +315,23 @@ function dyn(pnode, s) {
table.insertBefore(node, x);
}
}
+ } else if (pnode == "tr") {
+ var dummy = document.createElement("body");
+ dummy.innerHTML = "<table><tr>" + html + "</tr></table>";
+ runScripts(dummy);
+ var table = x.parentNode;
+
+ var arr = dummy.getElementsByTagName("tr");
+ firstChild = null;
+ if (arr.length > 0) {
+ var tbody = arr[0], next;
+ firstChild = document.createElement("script");
+ table.insertBefore(firstChild, x);
+ for (var node = tbody.firstChild; node; node = next) {
+ next = node.nextSibling;
+ table.insertBefore(node, x);
+ }
+ }
} else {
firstChild = document.createElement("span");
firstChild.innerHTML = html;
diff --git a/src/monoize.sml b/src/monoize.sml
index bd666edf..d774c697 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2645,13 +2645,15 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
| "dyn" =>
let
- val inTable = case targs of
- (L.CRecord (_, ctx), _) :: _ =>
- List.exists (fn ((L.CName "Table", _), _) => true
- | _ => false) ctx
- | _ => false
+ fun inTag tag = case targs of
+ (L.CRecord (_, ctx), _) :: _ =>
+ List.exists (fn ((L.CName tag', _), _) => tag' = tag
+ | _ => false) ctx
+ | _ => false
- val tag = if inTable then
+ val tag = if inTag "Tr" then
+ "tr"
+ else if inTag "Table" then
"table"
else
"span"
diff --git a/tests/dcol.ur b/tests/dcol.ur
new file mode 100644
index 00000000..b52cf3e4
--- /dev/null
+++ b/tests/dcol.ur
@@ -0,0 +1,8 @@
+fun main () =
+ s <- source <xml><td>A</td><td>A'</td></xml>;
+ return <xml><body>
+ <button value="Click me!" onclick={set s <xml><td>B</td><td>B'</td></xml>}/><br/>
+ <table><tr><td>Pre</td><td>Pre'</td></tr>
+ <tr><td>Hehe</td><dyn signal={signal s}/><td>Hoho</td></tr>
+ <tr><td>Post</td><td>Post</td><td>Post'</td></tr></table>
+ </body></xml>
diff --git a/tests/dcol.urp b/tests/dcol.urp
new file mode 100644
index 00000000..1337c668
--- /dev/null
+++ b/tests/dcol.urp
@@ -0,0 +1,3 @@
+debug
+
+dcol
diff --git a/tests/dcol.urs b/tests/dcol.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/dcol.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page