Skip to content

Commit 0089062

Browse files
author
Vlad Balin
committed
Merge pull request #110 from Volicon/develop
Fix inconsistent backbone collection behavior
2 parents 9bc884c + 438dc83 commit 0089062

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

nestedtypes.js

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"LICENSE"
3737
],
3838
"license": "MIT",
39-
"version": "1.1.3",
39+
"version": "1.1.4",
4040
"scripts": {
4141
"test": "node_modules/.bin/mocha",
4242
"build": "./node_modules/.bin/webpack",

src/collection.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ module.exports = Backbone.Collection.extend( {
3939
__changing : 0,
4040
_changed : false,
4141

42-
constructor : function(){
42+
// ATTENTION: Overriden backbone logic with bug fixes
43+
constructor : function( models, options ){
44+
options || (options = {});
45+
if (options.model) this.model = options.model;
46+
if (options.comparator !== void 0) this.comparator = options.comparator;
47+
this._reset();
48+
4349
this.__changing = 0;
4450
this._changed = false;
45-
51+
if (models) this.reset( models, options );
4652
this.listenTo( this, this._listenToChanges, handleChange );
47-
Backbone.Collection.apply( this, arguments );
53+
this.initialize.apply(this, arguments);
4854
},
4955

5056
getStore : function(){
@@ -61,6 +67,7 @@ module.exports = Backbone.Collection.extend( {
6167
} );
6268
},
6369

70+
// ATTENTION: Overriden backbone logic with bug fixes
6471
get : function( obj ){
6572
if( obj == null ){
6673
return void 0;

0 commit comments

Comments
 (0)