diff --git a/backbone.js b/backbone.js index 190cb06a..a4fd089c 100644 --- a/backbone.js +++ b/backbone.js @@ -253,6 +253,7 @@ if (!options.silent) { this.trigger('change:' + attr, this, void 0, options); this.change(options); + this._unsetAttributes = false; } return this; }, @@ -389,7 +390,6 @@ changed[attr] = void 0; } - this._unsetAttributes = false; return changed; }, diff --git a/test/model.js b/test/model.js index bfb499ea..76dc4b0b 100644 --- a/test/model.js +++ b/test/model.js @@ -175,7 +175,9 @@ $(document).ready(function() { model.unset('a', {silent: true}); var changedAttributes = model.changedAttributes(); ok('a' in changedAttributes, 'changedAttributes should contain unset properties'); - equals(changedAttributes.a, undefined); + + changedAttributes = model.changedAttributes(); + ok('a' in changedAttributes, 'changedAttributes should contain unset properties when running changedAttributes again after an unset.'); }); test("Model: using a non-default id attribute.", function() {