Add more characters that should not be un-escaped in regexps.

This commit is contained in:
Stefan Bethke 2016-09-30 15:10:23 +02:00
parent 947aef405c
commit b4f8e7dc7b

View File

@ -134,7 +134,7 @@ function OutputStream(options) {
function make_string(str, quote) { function make_string(str, quote) {
var dq = 0, sq = 0; var dq = 0, sq = 0;
str = str.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff\uffff]/g, str = str.replace(/[\\\b\f\n\r\v\t\x1f\x22\x27\u2028\u2029\0\ufeff\uffff]/g,
function(s, i){ function(s, i){
switch (s) { switch (s) {
case '"': ++dq; return '"'; case '"': ++dq; return '"';
@ -146,6 +146,7 @@ function OutputStream(options) {
case "\b": return "\\b"; case "\b": return "\\b";
case "\f": return "\\f"; case "\f": return "\\f";
case "\x0B": return options.screw_ie8 ? "\\v" : "\\x0B"; case "\x0B": return options.screw_ie8 ? "\\v" : "\\x0B";
case "\x1f": return "\\x1f";
case "\u2028": return "\\u2028"; case "\u2028": return "\\u2028";
case "\u2029": return "\\u2029"; case "\u2029": return "\\u2029";
case "\ufeff": return "\\ufeff"; case "\ufeff": return "\\ufeff";