Skip to content

Commit

Permalink
bail immediately if !this._changed
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Nov 10, 2011
1 parent 93ad86c commit 0c08ab8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@
// view need to be updated and/or what attributes need to be persisted to
// the server. Unset attributes will be set to undefined.
changedAttributes : function(now) {
if (!this._changed) return false;
now || (now = this.attributes);
var changed = false, old = this._previousAttributes;
for (var attr in now) {
if (_.isEqual(old[attr], now[attr])) continue;
(changed || (changed = {}))[attr] = now[attr];
}
if (!this._changed) return changed;
for (var attr in old) {
if (!(attr in now)) (changed || (changed = {}))[attr] = void 0;
}
Expand Down

0 comments on commit 0c08ab8

Please sign in to comment.