diff options
author | Andrew Dolgov <[email protected]> | 2011-11-08 20:40:44 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-11-08 20:40:44 +0400 |
commit | 81bea17aefb26859f825b9293c7c99192874806e (patch) | |
tree | fb244408ca271affa2899adb634788802c9a89d8 /lib/dojo/_base/json.js | |
parent | 870a70e109ac9e80a88047044530de53d0404ec7 (diff) |
upgrade Dojo to 1.6.1
Diffstat (limited to 'lib/dojo/_base/json.js')
-rw-r--r-- | lib/dojo/_base/json.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/dojo/_base/json.js b/lib/dojo/_base/json.js index 4d50400c9..4267c225e 100644 --- a/lib/dojo/_base/json.js +++ b/lib/dojo/_base/json.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ @@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo._base.json"]){ //_hasResource checks added by build. dojo._hasResource["dojo._base.json"] = true; dojo.provide("dojo._base.json"); + dojo.fromJson = function(/*String*/ json){ // summary: // Parses a [JSON](http://json.org) string to return a JavaScript object. @@ -16,12 +17,12 @@ dojo.fromJson = function(/*String*/ json){ // Throws for invalid JSON strings, but it does not use a strict JSON parser. It // delegates to eval(). The content passed to this method must therefore come // from a trusted source. - // json: + // json: // a string literal of a JSON item, for instance: // `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'` return eval("(" + json + ")"); // Object -} +}; dojo._escapeString = function(/*String*/str){ //summary: @@ -31,7 +32,7 @@ dojo._escapeString = function(/*String*/str){ return ('"' + str.replace(/(["\\])/g, '\\$1') + '"'). replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n"). replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string -} +}; dojo.toJsonIndentStr = "\t"; dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr){ @@ -75,8 +76,8 @@ dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _ind if(it === null){ return "null"; } - if(dojo.isString(it)){ - return dojo._escapeString(it); + if(dojo.isString(it)){ + return dojo._escapeString(it); } // recurse var recurse = arguments.callee; @@ -149,6 +150,6 @@ dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _ind output.push(newLine + nextIndent + keyStr + ":" + sep + val); } return "{" + output.join("," + sep) + newLine + _indentStr + "}"; // String -} +}; } |