aboutsummaryrefslogtreecommitdiff
path: root/lib/output.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-10-12 10:21:22 +0300
committerMihai Bazon <mihai.bazon@gmail.com>2015-10-12 10:21:22 +0300
commit17eef5a3c26bfa87879e270b1fa4743646bae559 (patch)
tree49ed11ad70680db8f5fd3a8553a73d41a11cc3d9 /lib/output.js
parent9f1f21b810ba3b996236cc7ef6757657757a007a (diff)
downloadtracifyjs-17eef5a3c26bfa87879e270b1fa4743646bae559.tar.gz
tracifyjs-17eef5a3c26bfa87879e270b1fa4743646bae559.zip
Only encode <!-- and --> in strings when inline_script
Diffstat (limited to 'lib/output.js')
-rw-r--r--lib/output.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/output.js b/lib/output.js
index 8ca0dc06..1bde822e 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -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;
};