rename _setEl to _setElement for parity

This commit is contained in:
Adam Krebs
2014-03-11 11:29:07 +04:00
parent b377e308ad
commit 20ed07489e

View File

@@ -1082,11 +1082,21 @@
// re-delegation. Pass along a set of attributes to be applied to the element.
setElement: function(element, attributes, delegate) {
this.undelegateEvents();
this._setEl(element, attributes);
this._setElement(element, attributes);
if (delegate !== false) this.delegateEvents();
return this;
},
// Creates the `this.el` and `this.$el` references for the View using the
// given `el` and a hash of `attributes`. `el` can be a CSS selector or an
// HTML string, a jQuery context or an element. Subclasses can override
// this to utilize an alternative DOM manipulation API.
_setElement: function(el, attributes) {
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
if (attributes) this.$el.attr(attributes);
this.el = this.$el[0];
},
// Set callbacks, where `this.events` is a hash of
//
// *{"event selector": "callback"}*
@@ -1140,16 +1150,6 @@
return this;
},
// Creates the `this.el` and `this.$el` references for the View using the
// given `el` and a hash of `attributes`. `el` can be a CSS selector or an
// HTML string, a jQuery context or an element. Subclasses can override
// this to utilize an alternative DOM manipulation API.
_setEl: function(el, attributes) {
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
if (attributes) this.$el.attr(attributes);
this.el = this.$el[0];
},
// Ensure that the View has a DOM element to render into.
// If `this.el` is a string, pass it through `$()`, take the first
// matching element, and re-assign it to `el`. Otherwise, create