Skip to content
Browse files

[enhance] xhtml: do not generate script tag if empty inline script

  • Loading branch information...
1 parent ee22493 commit b8f08373b91ea40278c8bbd3403d7218f706bb5b @Aqua-Ye Aqua-Ye committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 stdlib/core/xhtml/xhtml.opa
View
6 stdlib/core/xhtml/xhtml.opa
@@ -683,7 +683,7 @@ Xhtml =
@private sassoc_full(namespace, name, value) : Xml.attribute = ~{ namespace name value }
to_string = serialize_to_string
-
+
@private
JsEvent = {{
@@ -1101,7 +1101,9 @@ Xhtml =
* to be used with [prepare_for_xhtml_export]
*/
finalize_js_inline(js:xhtml):xhtml =
- {fragment = [of_string_unsafe(_script_start), js, of_string_unsafe(_script_end)]}
+ match compile(js)
+ {text=""} {content_unsafe=""} {fragment=[]} -> empty_xhtml
+ _ -> {fragment = [of_string_unsafe(_script_start), js, of_string_unsafe(_script_end)]}
/**
* Perform the final compilation of a html fragment.

0 comments on commit b8f0837

Please sign in to comment.
Something went wrong with that request. Please try again.