aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2013-09-06 10:10:45 +0300
committerMihai Bazon <mihai@bazon.net>2013-09-06 10:10:45 +0300
commit83ba338bd0e59267080c37bd235e1b0a601edf36 (patch)
tree9fc55095dad42ffba6949889837ab7e90f8c50aa
parent7c10b253462b0af3b8700e71ae2ae4aaac1a953e (diff)
downloadtracifyjs-83ba338bd0e59267080c37bd235e1b0a601edf36.tar.gz
tracifyjs-83ba338bd0e59267080c37bd235e1b0a601edf36.zip
Avoid printing <!-- in the output (HTML5 comment)
-rw-r--r--lib/output.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js
index df2692ad..e7f3f4dd 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -989,7 +989,18 @@ function OutputStream(options) {
self.left.print(output);
output.space();
output.print(self.operator);
- output.space();
+ if (self.operator == "<"
+ && self.right instanceof AST_UnaryPrefix
+ && self.right.operator == "!"
+ && self.right.expression instanceof AST_UnaryPrefix
+ && self.right.expression.operator == "--") {
+ // space is mandatory to avoid outputting <!--
+ // http://javascript.spec.whatwg.org/#comment-syntax
+ output.print(" ");
+ } else {
+ // the space is optional depending on "beautify"
+ output.space();
+ }
self.right.print(output);
});
DEFPRINT(AST_Conditional, function(self, output){