Skip to content

Commit

Permalink
Merge pull request #4267 from jgonggrijp/feature/comment-about-combin…
Browse files Browse the repository at this point in the history
…ed-defaults-and-extend

Comment about combined defaults and extend
  • Loading branch information
jgonggrijp authored Jul 20, 2023
2 parents 3b37e6a + 790682c commit 4abcaa5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@
if (options.collection) this.collection = options.collection;
if (options.parse) attrs = this.parse(attrs, options) || {};
var defaults = _.result(this, 'defaults');

// Just _.defaults would work fine, but the additional _.extends
// is in there for historical reasons. See #3843.
attrs = _.defaults(_.extend({}, defaults, attrs), defaults);

this.set(attrs, options);
this.changed = {};
this.initialize.apply(this, arguments);
Expand Down

0 comments on commit 4abcaa5

Please sign in to comment.