Merged in Selenium optimizations from http://github.com/gannett/jasmine branch. Updated json2 to latest.

This commit is contained in:
ragaskar
2009-09-29 22:09:30 -07:00
parent a394b564f4
commit 250c483a6b
26 changed files with 1538 additions and 1403 deletions
+10 -10
View File
@@ -1,6 +1,6 @@
/*
http://www.JSON.org/json2.js
2008-11-19
2009-08-17
Public Domain.
@@ -33,7 +33,7 @@
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the object holding the key.
bound to the value
For example, this would serialize Dates as ISO strings.
@@ -146,8 +146,6 @@
/*jslint evil: true */
/*global JSON */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
@@ -155,12 +153,15 @@
test, toJSON, toString, valueOf
*/
"use strict";
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (!this.JSON) {
JSON = {};
this.JSON = {};
}
(function () {
function f(n) {
@@ -172,12 +173,13 @@ if (!this.JSON) {
Date.prototype.toJSON = function (key) {
return this.getUTCFullYear() + '-' +
return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
f(this.getUTCSeconds()) + 'Z' : null;
};
String.prototype.toJSON =
@@ -222,7 +224,6 @@ if (!this.JSON) {
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
@@ -351,7 +352,6 @@ if (!this.JSON) {
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
@@ -475,4 +475,4 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
throw new SyntaxError('JSON.parse');
};
}
})();
}());