documentcloud/backbone — pull request #2022 by adriaanlabusc (2012-12-26 04:05:24+00:00)
Title: Changed the model's set function so that the 'nested' variable isn't req...

...uired

There used to be a line that read: `this._pending = !!changes.length;`
This caused `this._pending` to sometimes be set to `false` when model.set is called from within a change event. It would, for instance, happen during this test:

```javascript
test("final `change` event is fired when interim changes set an attribute without changing it's value", 1, function () {
var model = new Backbone.Model({foo: 1, bar: 2});
model.on('change:foo', function() {
model.set({bar: 2});
console.log('property changeevnt');
});
model.on('change', function() {
ok(true);
});
model.set({foo: 10});
});
```

During `model.set({bar: 2});`, `this._pending` gets set to `false` and therefore no `change` event would get triggered (without the use of `nested`). `nested` was used to trigger this event like so:

```javascript
if (!this._pending && nested) this.trigger('change', this, options);
```

This commit changes the method so that `nested` is no longer required.

Note: the test is't in the test sweet, and all the current tests pass. Merry Christmas.

Signed-off-by: Adriaan Labuschagne