documentcloud/backbone — pull request #879 by braddunbar (2012-01-20 16:11:14+00:00)
Title: Setting Undefined Attributes

* undefined attrs should still be set
* unset triggers change for undefined attrs
* values are set regardless of change/equality

Currently, when setting an attribute as `undefined` it is not actually added to `attributes`. I think the property should be added even if it is undefined.

'x' in new Backbone.Model({x: undefined}).attributes; // should be true

Also, I think an equal value should still be set, even if `'change'` is not fired.

var a = [];
var model = new Backbone.Model({x: []});
model.set({x: a}); // does not fire 'change'
model.get('x') === a; // should be true

I realize this is a significant change in semantics, but I think it's much more intuitive. Have I overlooked any problems this may cause?