From e0b61034dfa6a65e4d8388127e26268ac55c42dd Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Wed, 13 Oct 2010 17:25:04 -0400 Subject: [PATCH] internal _initialize to _reset --- backbone.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/backbone.js b/backbone.js index 28dd788c..eeddab20 100644 --- a/backbone.js +++ b/backbone.js @@ -305,7 +305,7 @@ delete options.comparator; } this._boundOnModelEvent = _.bind(this._onModelEvent, this); - this._initialize(); + this._reset(); if (models) this.refresh(models,true); }; @@ -372,7 +372,7 @@ return new collection.model(attrs); }); } - this._initialize(); + this._reset(); this.add(models, {silent: true}); if (!options.silent) this.trigger('refresh', this); return this; @@ -405,9 +405,8 @@ return model.save(null, {success : success, error : options.error}); }, - // Initialize or re-initialize all internal state. Called when the - // collection is refreshed. - _initialize : function(options) { + // Reset all internal state. Called when the collection is refreshed. + _reset : function(options) { this.length = 0; this.models = []; this._byId = {}; @@ -484,7 +483,7 @@ // Creating a Backbone.View creates its intial element outside of the DOM, // if an existing element is not provided... Backbone.View = function(options) { - this._initialize(options || {}); + this._reset(options || {}); if (this.options.el) { this.el = this.options.el; } else { @@ -569,7 +568,7 @@ // Performs the initial configuration of a View with a set of options. // Keys with special meaning *(model, collection, id, className)*, are // attached directly to the view. - _initialize : function(options) { + _reset : function(options) { if (this.options) options = _.extend({}, this.options, options); if (options.model) this.model = options.model; if (options.collection) this.collection = options.collection;