Only encode <!-- and --> in strings when inline_script
authorMihai Bazon <mihai.bazon@gmail.com>
Mon, 12 Oct 2015 07:21:22 +0000 (10:21 +0300)
committerMihai Bazon <mihai.bazon@gmail.com>
Mon, 12 Oct 2015 07:21:22 +0000 (10:21 +0300)
lib/output.js

index 8ca0dc0..1bde822 100644 (file)
@@ -125,10 +125,11 @@ function OutputStream(options) {
 
     function encode_string(str, quote) {
         var ret = make_string(str, quote);
-        if (options.inline_script)
+        if (options.inline_script) {
             ret = ret.replace(/<\x2fscript([>\/\t\n\f\r ])/gi, "<\\/script$1");
-        ret = ret.replace(/\x3c!--/g, "\\x3c!--");
-        ret = ret.replace(/--\x3e/g, "--\\x3e");
+            ret = ret.replace(/\x3c!--/g, "\\x3c!--");
+            ret = ret.replace(/--\x3e/g, "--\\x3e");
+        }
         return ret;
     };