From eec1cc7a37e04f9c4195ede0233ed773f2e964a9 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Mon, 21 Apr 2014 12:09:58 -0400 Subject: Change to avoid generating an empty for empty content --- lib/js/urweb.js | 8 +++++--- tests/activeEmpty.ur | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests/activeEmpty.ur diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 2e350378..fe628130 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1009,8 +1009,6 @@ function active(s) { if (suspendScripts) return; - var span = document.createElement("span"); - addNode(span); var ms = maySuspend; maySuspend = false; try { @@ -1020,7 +1018,11 @@ function active(s) { throw e; } maySuspend = ms; - setInnerHTML(span, html); + if (html != "") { + var span = document.createElement("span"); + addNode(span); + setInnerHTML(span, html); + } } function input(x, s, recreate, type, name) { diff --git a/tests/activeEmpty.ur b/tests/activeEmpty.ur new file mode 100644 index 00000000..4c089899 --- /dev/null +++ b/tests/activeEmpty.ur @@ -0,0 +1,5 @@ +fun main () : transaction page = return + }/> +
+ This one ain't empty.
}/> + -- cgit v1.2.3