comparison lib/js/urweb.js @ 2002:9356e8f91ea4

Change <active> to avoid generating an empty <span> for empty content
author Adam Chlipala <adam@chlipala.net>
date Mon, 21 Apr 2014 12:09:58 -0400
parents abb6981a2c4c
children 93ff76058825
comparison
equal deleted inserted replaced
2001:16f5f136a807 2002:9356e8f91ea4
1007 1007
1008 function active(s) { 1008 function active(s) {
1009 if (suspendScripts) 1009 if (suspendScripts)
1010 return; 1010 return;
1011 1011
1012 var span = document.createElement("span");
1013 addNode(span);
1014 var ms = maySuspend; 1012 var ms = maySuspend;
1015 maySuspend = false; 1013 maySuspend = false;
1016 try { 1014 try {
1017 var html = execF(s); 1015 var html = execF(s);
1018 } catch (e) { 1016 } catch (e) {
1019 maySuspend = ms; 1017 maySuspend = ms;
1020 throw e; 1018 throw e;
1021 } 1019 }
1022 maySuspend = ms; 1020 maySuspend = ms;
1023 setInnerHTML(span, html); 1021 if (html != "") {
1022 var span = document.createElement("span");
1023 addNode(span);
1024 setInnerHTML(span, html);
1025 }
1024 } 1026 }
1025 1027
1026 function input(x, s, recreate, type, name) { 1028 function input(x, s, recreate, type, name) {
1027 if (name) x.name = name; 1029 if (name) x.name = name;
1028 if (type) x.type = type; 1030 if (type) x.type = type;