Skip to content
This repository
Browse code

Merge pull request #2022 from adriaanlabusc/remove_nested

Changed the model's set function so that the 'nested' variable isn't req...
  • Loading branch information...
commit 323d216f76a73b9de9959c12f869cd7ddb326822 2 parents 047d0d6 + 4f1cb85
Tim Griesser authored December 26, 2012

Showing 1 changed file with 2 additions and 5 deletions. Show diff stats Hide diff stats

  1. 7  backbone.js
7  backbone.js
@@ -291,7 +291,7 @@
291 291
     // Set a hash of model attributes on the object, firing `"change"` unless
292 292
     // you choose to silence it.
293 293
     set: function(key, val, options) {
294  
-      var attr, attrs, unset, changes, silent, nested, changing, prev, current;
  294
+      var attr, attrs, unset, changes, silent, changing, prev, current;
295 295
       if (key == null) return this;
296 296
 
297 297
       // Handle both `"key", value` and `{key: value}` -style arguments.
@@ -308,7 +308,6 @@
308 308
       unset           = options.unset;
309 309
       silent          = options.silent;
310 310
       changes         = [];
311  
-      nested          = false;
312 311
       changing        = this._changing;
313 312
       this._changing  = true;
314 313
 
@@ -329,7 +328,6 @@
329 328
         val = attrs[attr];
330 329
         if (!_.isEqual(current[attr], val)) changes.push(attr);
331 330
         if (!_.isEqual(prev[attr], val)) {
332  
-          nested = true;
333 331
           this.changed[attr] = val;
334 332
         } else {
335 333
           delete this.changed[attr];
@@ -337,7 +335,7 @@
337 335
         unset ? delete current[attr] : current[attr] = val;
338 336
       }
339 337
 
340  
-      this._pending = !!changes.length;
  338
+      if (changes.length) this._pending = true;
341 339
 
342 340
       // Trigger all relevant attribute changes.
343 341
       if (!silent) {
@@ -348,7 +346,6 @@
348 346
 
349 347
       if (changing) return this;
350 348
       if (!silent) {
351  
-        if (!this._pending && nested) this.trigger('change', this, options);
352 349
         while (this._pending) {
353 350
           this._pending = false;
354 351
           this.trigger('change', this, options);

0 notes on commit 323d216

Please sign in to comment.
Something went wrong with that request. Please try again.