|
|
|
@ -12,8 +12,6 @@ var js = {
|
|
|
|
|
* may appear in the form of an escape sequence.
|
|
|
|
|
*
|
|
|
|
|
* For portability, we also escape all control and non-ASCII characters.
|
|
|
|
|
* Note that the "\v" escape sequence is not used because IE does not like
|
|
|
|
|
* it.
|
|
|
|
|
*/
|
|
|
|
|
return s
|
|
|
|
|
.replace(/\\/g, '\\\\') // backslash
|
|
|
|
@ -22,6 +20,7 @@ var js = {
|
|
|
|
|
.replace(/\x08/g, '\\b') // backspace
|
|
|
|
|
.replace(/\t/g, '\\t') // horizontal tab
|
|
|
|
|
.replace(/\n/g, '\\n') // line feed
|
|
|
|
|
.replace(/\v/g, '\\v') // vertical tab
|
|
|
|
|
.replace(/\f/g, '\\f') // form feed
|
|
|
|
|
.replace(/\r/g, '\\r') // carriage return
|
|
|
|
|
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
|
|
|
@ -45,7 +44,7 @@ var js = {
|
|
|
|
|
.replace(/\0/g, '\\0') // null
|
|
|
|
|
.replace(/\t/g, '\\t') // horizontal tab
|
|
|
|
|
.replace(/\n/g, '\\n') // line feed
|
|
|
|
|
.replace(/\v/g, '\\x0B') // vertical tab
|
|
|
|
|
.replace(/\v/g, '\\v') // vertical tab
|
|
|
|
|
.replace(/\f/g, '\\f') // form feed
|
|
|
|
|
.replace(/\r/g, '\\r') // carriage return
|
|
|
|
|
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
|
|
|
|