diff options
| author | Igor Minar | 2012-03-27 10:21:49 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-03-28 16:30:38 -0700 |
| commit | 87f5c6e5b716100e203ec59c5874c3e927f83fa0 (patch) | |
| tree | 84f2953b17d9ef5b9ddc4bde298adea9f503b3bd /src | |
| parent | a8a750ab05bdff73ba3af0b98f3f284ff8d1e743 (diff) | |
| download | angular.js-87f5c6e5b716100e203ec59c5874c3e927f83fa0.tar.bz2 | |
refactor(fromJson): always use native JSON.parse
This breaks IE7 for which you can use polyfill:
https://github.com/douglascrockford/JSON-js
<!--[if lt IE 8]>
<script src="json2.min.js"></script>
<![endif]-->
or
http://bestiejs.github.com/json3/
<!--[if lt IE 8]>
<script src="json3.min.js"></script>
<![endif]-->
Diffstat (limited to 'src')
| -rw-r--r-- | src/JSON.js | 9 | ||||
| -rw-r--r-- | src/ng/parse.js | 6 |
2 files changed, 3 insertions, 12 deletions
diff --git a/src/JSON.js b/src/JSON.js index cddfc52d..bcb5fabe 100644 --- a/src/JSON.js +++ b/src/JSON.js @@ -27,15 +27,12 @@ function toJson(obj, pretty) { * Deserializes a JSON string. * * @param {string} json JSON string to deserialize. - * @param {boolean} [useNative=false] Use native JSON parser, if available. * @returns {Object|Array|Date|string|number} Deserialized thingy. */ -function fromJson(json, useNative) { - if (!isString(json)) return json; - - return (useNative && window.JSON && window.JSON.parse) +function fromJson(json) { + return isString(json) ? JSON.parse(json) - : parseJson(json, true)(); + : json; } diff --git a/src/ng/parse.js b/src/ng/parse.js index 47c5188e..cd60bc83 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -752,9 +752,3 @@ function $ParseProvider() { }; }]; } - - -// This is a special access for JSON parser which bypasses the injector -var parseJson = function(json) { - return parser(json, true); -}; |
