mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-23 05:48:10 -05:00
set _changing = false only if !alreadyChanging
This commit is contained in:
@@ -211,8 +211,10 @@
|
||||
}
|
||||
|
||||
// Fire the `"change"` event, if the model has been changed.
|
||||
if (!alreadyChanging && !options.silent && this._changed) this.change(options);
|
||||
this._changing = false;
|
||||
if (!alreadyChanging) {
|
||||
if (!options.silent && this._changed) this.change(options);
|
||||
this._changing = false;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
@@ -449,4 +449,13 @@ $(document).ready(function() {
|
||||
a.set({state: 'hello'});
|
||||
});
|
||||
|
||||
test("Model: Multiple nested calls to set", function() {
|
||||
var model = new Backbone.Model({});
|
||||
model.bind('change', function() {
|
||||
model.set({b: 1});
|
||||
model.set({a: 1});
|
||||
})
|
||||
.set({a: 1});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user