summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-05 09:26:00 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-05 09:26:00 -0400
commitc042b1bb94be89cc99fe4226edc3ce920d99f56b (patch)
tree58141d6d89f51fcbceb8bed54f35c38f50120d60 /src
parentb05b60f5cdaa0da92af54640f8a2db6e18a283ba (diff)
Avoid generating empty <script> blocks
Diffstat (limited to 'src')
-rw-r--r--src/c/urweb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 476fb09b..9915219d 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -692,6 +692,8 @@ void uw_write_script(uw_context ctx, uw_Basis_string s) {
const char *uw_Basis_get_script(uw_context ctx, uw_unit u) {
if (ctx->script_header[0] == 0)
return "";
+ else if (buf_used(&ctx->script) == 0)
+ return ctx->script_header;
else {
char *r = uw_malloc(ctx, strlen(ctx->script_header) + 42 + buf_used(&ctx->script));
sprintf(r, "%s<script type=\"text/javascript\">%s</script>",