mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
rename _setEl to _setElement for parity
This commit is contained in:
22
backbone.js
22
backbone.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user