Skip to content

Commit

Permalink
Fix jashkenas#1791 reorder constructor so attributes is defined for…
Browse files Browse the repository at this point in the history
… `parse`
  • Loading branch information
caseywebdev committed Nov 2, 2012
1 parent 34cb42d commit 34ce371
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,16 @@
var defaults;
var attrs = attributes || {};
if (options && options.collection) this.collection = options.collection;
if (options && options.parse) attrs = this.parse(attrs);
if (defaults = _.result(this, 'defaults')) {
attrs = _.extend({}, defaults, attrs);
}
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');
this.changed = {};
this._changes = {};
this._pending = {};
if (options && options.parse) attrs = this.parse(attrs);
if (defaults = _.result(this, 'defaults')) {
attrs = _.extend({}, defaults, attrs);
}
this.set(attrs, {silent: true});
// Reset change tracking.
this.changed = {};
Expand Down

0 comments on commit 34ce371

Please sign in to comment.