|
|
@ -12,12 +12,13 @@ var js = {
|
|
|
|
* may appear in the form of an escape sequence.
|
|
|
|
* may appear in the form of an escape sequence.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* For portability, we also escape all control and non-ASCII characters.
|
|
|
|
* For portability, we also escape all control and non-ASCII characters.
|
|
|
|
* Note that "\0" and "\v" escape sequences are not used because JSHint does
|
|
|
|
* Note that the "\v" escape sequence is not used because IE does not like
|
|
|
|
* not like the first and IE the second.
|
|
|
|
* it.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
return s
|
|
|
|
return s
|
|
|
|
.replace(/\\/g, '\\\\') // backslash
|
|
|
|
.replace(/\\/g, '\\\\') // backslash
|
|
|
|
.replace(/"/g, '\\"') // closing double quote
|
|
|
|
.replace(/"/g, '\\"') // closing double quote
|
|
|
|
|
|
|
|
.replace(/\0/g, '\\0') // null
|
|
|
|
.replace(/\x08/g, '\\b') // backspace
|
|
|
|
.replace(/\x08/g, '\\b') // backspace
|
|
|
|
.replace(/\t/g, '\\t') // horizontal tab
|
|
|
|
.replace(/\t/g, '\\t') // horizontal tab
|
|
|
|
.replace(/\n/g, '\\n') // line feed
|
|
|
|
.replace(/\n/g, '\\n') // line feed
|
|
|
|