summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/codeq/core.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/codeq/core.js b/js/codeq/core.js
index f1bd697..b54095f 100644
--- a/js/codeq/core.js
+++ b/js/codeq/core.js
@@ -144,18 +144,19 @@
regexpBackslash = new RegExp('\\\\', 'g'),
regexpWhiteSpaceStart = new RegExp('^[ \r\n\t]+'),
regexpWhiteSpaceEnd = new RegExp('[ \r\n\t]+$'),
- regexpWhiteSpaceNonPrintable = new RegExp('[\r\n\t]', 'g'),
regexpWhiteSpaceBeforeTag = new RegExp('[ \r\n\t]+(?=<)', 'g'),
regexpWhiteSpaceAfterTag = new RegExp('>[ \r\n\t]+', 'g'),
- regexpWhiteSpace = new RegExp('[ \\r\\n\\t]+'),
regexpWhiteSpaceTrim = new RegExp('^[ \\t\\r\\n]*(.*[^ \\t\\r\\n])[ \\t\\r\\n]*$', 'm'),
regexpAmp = new RegExp('&', 'g'),
regexpLt = new RegExp('<', 'g'),
- regexpGt = new RegExp('>', 'g');
+ regexpGt = new RegExp('>', 'g'),
+ regexpCR = new RegExp('\\r', 'g'),
+ regexpLF = new RegExp('\\n', 'g'),
+ regexpTab = new RegExp('\\t', 'g');
// convert a string into its definition (javascript literal)
var stringToDef = function (str) {
- return str.replace(regexpBackslash, '\\\\').replace(regexpQuote, '\\"').replace(regexpWhiteSpaceNonPrintable, ' ');
+ return str.replace(regexpBackslash, '\\\\').replace(regexpQuote, '\\"').replace(regexpCR, '\\r').replace(regexpLF, '\\n').replace(regexpTab, '\\t');
};
// given a HTML source, remove whitespace among tags