diff --git a/backbone.js b/backbone.js index ca167e9a..deedb0ed 100644 --- a/backbone.js +++ b/backbone.js @@ -594,7 +594,7 @@ // Get a model from the set by id. get: function(id) { - if (id == null) return null; + if (id == null) return void 0; return this._byId[id.id != null ? id.id : id]; }, @@ -979,7 +979,7 @@ // // The options object can contain `trigger: true` if you wish to have the // route callback be fired (not usually desirable), or `replace: true`, if - // you which to modify the current URL without adding an entry to the history. + // you wish to modify the current URL without adding an entry to the history. navigate: function(fragment, options) { if (!historyStarted) return false; if (!options || options === true) options = {trigger: options}; diff --git a/test/collection.js b/test/collection.js index b4c5ee92..0f081571 100644 --- a/test/collection.js +++ b/test/collection.js @@ -522,4 +522,10 @@ $(document).ready(function() { raises(function() { col.add([{id: 1}, {id: 1}]); }); }); + test("#964 - collection.get return in consistent", function() { + var c = new Backbone.Collection(); + ok(c.get(null) === undefined); + ok(c.get() === undefined); + }); + });