From f92a38c957b15bd5c4243d6aba527a1db8edc473 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 22 Jul 2012 09:42:17 -0400 Subject: Nicer semantics --- lib/js/urweb.js | 6 +++--- tests/activeFocus.ur | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/activeFocus.ur diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 87adc0a3..1f003fc3 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -803,7 +803,6 @@ function dyn(pnode, s) { var dummy = document.createElement("body"); dummy.innerHTML = "" + html + "
"; - runScripts(dummy); var table = x.parentNode; if (table) { @@ -831,12 +830,12 @@ function dyn(pnode, s) { for (var node = tbody.firstChild; node; node = next) { next = node.nextSibling; table.insertBefore(node, x); + runScripts(node); } } } else if (pnode == "tr") { var dummy = document.createElement("body"); dummy.innerHTML = "" + html + "
"; - runScripts(dummy); var table = x.parentNode; if (table) { @@ -854,14 +853,15 @@ function dyn(pnode, s) { for (var node = tr.firstChild; node; node = next) { next = node.nextSibling; table.insertBefore(node, x); + runScripts(node); } } } else { firstChild = document.createElement("span"); firstChild.innerHTML = html; - runScripts(firstChild); if (x.parentNode) x.parentNode.insertBefore(firstChild, x); + runScripts(firstChild); } }; diff --git a/tests/activeFocus.ur b/tests/activeFocus.ur new file mode 100644 index 00000000..94d465e9 --- /dev/null +++ b/tests/activeFocus.ur @@ -0,0 +1,18 @@ +fun main () : transaction page = + i <- fresh; + return + + + Done}/> + + +fun dynamic () : transaction page = + x <- source ; + return + +