changeset 696:79a49c509007

Avoid generating empty <script> blocks
author Adam Chlipala <adamc@hcoop.net>
date Sun, 05 Apr 2009 09:26:00 -0400
parents 500e93aa436f
children 755a71c99be5
files src/c/urweb.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/c/urweb.c	Sat Apr 04 15:56:47 2009 -0400
+++ b/src/c/urweb.c	Sun Apr 05 09:26:00 2009 -0400
@@ -692,6 +692,8 @@
 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>",