From 581d73afe05427acefac181dc683d9d1f6d5774a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 31 Oct 2012 00:38:38 -0700 Subject: [PATCH 01/35] Update vendors. Former-commit-id: 76887b14d32e661f4c415393637478d93174329d --- vendor/backbone/backbone.js | 31 +++++++++++++++--------------- vendor/backbone/test/collection.js | 15 +++++++++++++++ vendor/json3/README.md | 6 +++--- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/vendor/backbone/backbone.js b/vendor/backbone/backbone.js index 1f0d118220..8953d47c78 100644 --- a/vendor/backbone/backbone.js +++ b/vendor/backbone/backbone.js @@ -261,15 +261,16 @@ // Set a hash of model attributes on the object, firing `"change"` unless // you choose to silence it. - set: function(attrs, options) { - var attr, key, val; - if (attrs == null) return this; + set: function(key, val, options) { + var attr, attrs; + if (key == null) return this; // Handle both `"key", value` and `{key: value}` -style arguments. - if (!_.isObject(attrs)) { - key = attrs; - (attrs = {})[key] = options; - options = arguments[2]; + if (_.isObject(key)) { + attrs = key; + options = val; + } else { + (attrs = {})[key] = val; } // Extract attributes and options. @@ -352,14 +353,15 @@ // Set a hash of model attributes, and sync the model to the server. // If the server returns an attributes hash that differs, the model's // state will be `set` again. - save: function(attrs, options) { - var key, current, done; + save: function(key, val, options) { + var attrs, current, done; // Handle both `"key", value` and `{key: value}` -style arguments. - if (attrs != null && !_.isObject(attrs)) { - key = attrs; - (attrs = {})[key] = options; - options = arguments[2]; + if (key == null || _.isObject(key)) { + attrs = key; + options = val; + } else if (key != null) { + (attrs = {})[key] = val; } options = options ? _.clone(options) : {}; @@ -948,8 +950,7 @@ if (!this.routes) return; var route, routes = _.keys(this.routes); while ((route = routes.pop()) != null) { - var name = this.routes[route]; - this.route(route, name, this[name]); + this.route(route, this.routes[route]); } }, diff --git a/vendor/backbone/test/collection.js b/vendor/backbone/test/collection.js index 576de3fe05..7875f86f57 100644 --- a/vendor/backbone/test/collection.js +++ b/vendor/backbone/test/collection.js @@ -701,4 +701,19 @@ $(document).ready(function() { collection.add([{id: 1, x: 1}, {id: 2, x: 2}]); deepEqual(added, [1, 2]); }); + + test("fetch parses models by default", 1, function() { + var model = {}; + var Collection = Backbone.Collection.extend({ + url: 'test', + model: Backbone.Model.extend({ + parse: function(resp) { + strictEqual(resp, model); + } + }) + }); + new Collection().fetch(); + this.ajaxSettings.success([model]); + }); + }); diff --git a/vendor/json3/README.md b/vendor/json3/README.md index 4c292ceb86..a2852a206f 100644 --- a/vendor/json3/README.md +++ b/vendor/json3/README.md @@ -4,8 +4,8 @@ **JSON 3** is a modern JSON implementation compatible with a variety of JavaScript platforms, including Internet Explorer 6, Opera 7, Safari 2, and Netscape 6. The current version is **3.2.4**. -- [Development Version](http://bestiejs.github.com/json3/lib/json3.js) *(36.5 KB; uncompressed with comments)* -- [Production Version](http://bestiejs.github.com/json3/lib/json3.min.js) *(3.0 KB; compressed and `gzip`-ped)* +- [Development Version](http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.js) *(36.5 KB; uncompressed with comments)* +- [Production Version](http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.4/json3.min.js) *(3.0 KB; compressed and `gzip`-ped)* [JSON](http://json.org/) is a language-independent data interchange format based on a loose subset of the JavaScript grammar. Originally popularized by [Douglas Crockford](http://www.crockford.com/), the format was standardized in the [fifth edition](http://es5.github.com/) of the ECMAScript specification. The 5.1 edition, ratified in June 2011, incorporates several modifications to the grammar pertaining to the serialization of dates. @@ -42,7 +42,7 @@ Portions of the date serialization code are adapted from the [`date-shim`](https ## Web Browsers - +