[Pkg-javascript-commits] [backbone] 236/281: resolved merge

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:02:17 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.9.0
in repository backbone.

commit 04c2d10f30e40efce8db1adcb2f122097e47ed9e
Merge: efa58fd 8d5f50a
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Sun Jan 22 12:45:39 2012 -0500

    resolved merge

 backbone.js        |  36 ++++----
 test/collection.js | 235 ++++++++++++++++++++++++++++++-----------------------
 test/events.js     |  30 +++----
 test/model.js      | 204 ++++++++++++++++++++++++++--------------------
 test/noconflict.js |   8 +-
 test/router.js     |  58 ++++++-------
 test/sync.js       |  94 ++++++++++-----------
 test/view.js       |  68 ++++++++--------
 8 files changed, 396 insertions(+), 337 deletions(-)

diff --cc backbone.js
index 7803e8d,d1ef1fd..0fdec96
--- a/backbone.js
+++ b/backbone.js
@@@ -363,8 -363,8 +363,8 @@@
      },
  
      // Create a new model with identical attributes to this one.
 -    clone : function() {
 +    clone: function() {
-       return new this.constructor(this);
+       return new this.constructor(this.attributes);
      },
  
      // A model is new if it has never been saved to the server, and lacks an id.
@@@ -468,15 -468,13 +468,13 @@@
      },
  
      // Add a model, or list of models to the set. Pass **silent** to avoid
-     // firing the `added` event for every new model.
+     // firing the `add` event for every new model.
 -    add : function(models, options) {
 +    add: function(models, options) {
-       var i, index, length;
+       var i, index, length, model, cids = {};
        options || (options = {});
-       if (!_.isArray(models)) models = [models];
-       models = slice.call(models);
+       models = _.isArray(models) ? models.slice() : [models];
        for (i = 0, length = models.length; i < length; i++) {
-         var model = models[i] = this._prepareModel(models[i], options);
-         if (!model) {
+         if (!(model = models[i] = this._prepareModel(models[i], options))) {
            throw new Error("Can't add an invalid model to a collection");
          }
          var hasId = model.id != null;
@@@ -500,11 -502,11 +502,11 @@@
      },
  
      // Remove a model, or a list of models from the set. Pass silent to avoid
-     // firing the `removed` event for every model removed.
+     // firing the `remove` event for every model removed.
 -    remove : function(models, options) {
 +    remove: function(models, options) {
        var i, index, model;
        options || (options = {});
-       models = _.isArray(models) ? slice.call(models) : [models];
+       models = _.isArray(models) ? models.slice() : [models];
        for (i = 0, l = models.length; i < l; i++) {
          model = this.getByCid(models[i]) || this.get(models[i]);
          if (!model) continue;
@@@ -561,8 -563,8 +563,8 @@@
  
      // When you have more items than you want to add or remove individually,
      // you can reset the entire set with a new list of models, without firing
-     // any `added` or `removed` events. Fires `reset` when finished.
+     // any `add` or `remove` events. Fires `reset` when finished.
 -    reset : function(models, options) {
 +    reset: function(models, options) {
        models  || (models = []);
        options || (options = {});
        for (var i = 0, l = this.models.length; i < l; i++) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list