1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-09-24 23:40:43 +02:00

Don't display javascript result if function returned nothing

This commit is contained in:
Elisabeth Henry 2017-06-04 04:42:32 +02:00
parent c1aeb9c596
commit d7953815cc

View File

@ -83,9 +83,12 @@ impl<'a> HtmlIfRenderer<'a> {
id = id,
code = code));
html_if.curr_init
.push_str(&format!(" document.getElementById(\"result_{id}\").innerHTML = fn_{id}();\n",
.push_str(&format!(" result = fn_{id}();
if (result != undefined) {{
document.getElementById(\"result_{id}\").innerHTML = fn_{id}();
}}\n",
id = id));
let content = format!("<p id = \"result_{}\"></p>\n",
let content = format!("<div id = \"result_{}\"></div>\n",
(html_if.n_fn));
html_if.n_fn += 1;
Ok(content)