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