Skip to content

Commit

Permalink
Fixed mootools compatibility problem in client/json2.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan4th committed Feb 21, 2012
1 parent 2c56eef commit 26a8b87
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/json2.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ if (!this.JSON) {
value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
typeof value.toJSON === 'function' &&
// avoid problem with mootools
(!Array.prototype.toJSON ||
Object.prototype.toString.apply(value) !== '[object Array]')) {
value = value.toJSON(key);
}

Expand All @@ -252,7 +254,6 @@ if (!this.JSON) {
}

// What happens next depends on the value's type.

switch (typeof value) {
case 'string':
return quote(value);
Expand Down

0 comments on commit 26a8b87

Please sign in to comment.