Repository navigation
Minor Patch
- Fixed an issue when adding the same options object to two different instances during initialization, if a
defaultsoption was defined for the instance prototype that returned an object, then the two resulting instances would both end up sharing the same resulting default object.
Here is an example of the bug:
// Define a Layout that applies defaults containing an object.
var MyLayout = BackboneLayout.extend({
defaults: function() {
return {shared: new SomeObject()}
}
})
// Now, define shared options
var options = {
'foo': 'bar'
}
// Finally, instantiate two instances of 'MyLayout', both sharing the same options object.
var layout1 = new MyLayout(options);
var layout2 = new MyLayout(options);
// They will both share the same 'shared' object
layout1.options.shared === layout2.options.shared;
>> trueThis will no longer happen. The two instances will now have separate instances of the shared object.