Skip to content

Commit 3d7767b

Browse files
IE8
1 parent 2468916 commit 3d7767b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

json.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
json.js
3-
2013-05-26
3+
2014-02-04
44
55
Public Domain
66
@@ -229,19 +229,11 @@ if (typeof JSON !== 'object') {
229229
};
230230
}
231231

232-
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
233-
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
232+
var cx,
233+
escapable,
234234
gap,
235235
indent,
236-
meta = { // table of character substitutions
237-
'\b': '\\b',
238-
'\t': '\\t',
239-
'\n': '\\n',
240-
'\f': '\\f',
241-
'\r': '\\r',
242-
'"' : '\\"',
243-
'\\': '\\\\'
244-
},
236+
meta,
245237
rep;
246238

247239

@@ -392,6 +384,16 @@ if (typeof JSON !== 'object') {
392384
// If the JSON object does not yet have a stringify method, give it one.
393385

394386
if (typeof JSON.stringify !== 'function') {
387+
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
388+
meta = { // table of character substitutions
389+
'\b': '\\b',
390+
'\t': '\\t',
391+
'\n': '\\n',
392+
'\f': '\\f',
393+
'\r': '\\r',
394+
'"' : '\\"',
395+
'\\': '\\\\'
396+
};
395397
JSON.stringify = function (value, replacer, space) {
396398

397399
// The stringify method takes a value and an optional replacer, and an optional
@@ -439,6 +441,7 @@ if (typeof JSON !== 'object') {
439441
// If the JSON object does not yet have a parse method, give it one.
440442

441443
if (typeof JSON.parse !== 'function') {
444+
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
442445
JSON.parse = function (text, reviver) {
443446

444447
// The parse method takes a text and an optional reviver function, and returns

0 commit comments

Comments
 (0)