documentcloud/backbone — Issue #912: "silent: true" is overloaded for set
Author: TrisMcC
Created: 2012-01-31 16:05:04+00:00
State: open

There is a change in how the 'change' event is detected for the set() function. Setting a property with 'silent: true' and then setting that property back to the original value without 'silent: true' will not trigger the change event.

This is because when silent is true, the _previousAttributes object is not changed (same as in 0.5.3), but now set() does its checks against that object.

This code is in a jsfiddle at http://jsfiddle.net/kGfBM/2/

```javascript
var Model = Backbone.Model.extend({
initialize: function() {
this.bind('change:name', this.change);
},

change: function(model, name) {
console.log(model);
console.log(name);
console.log("Changed name from " + this.previous("name") + " to " + this.get('name'));
}
});

var model = new Model({ name: 'name1' });
model.set({ name: 'name2' }, { silent: true });
model.set({ name: 'name1' });
```