This allows views to directly pass this.$('selector') to a subview's constructor or directly to #setElement:
var View = Backbone.View.extend({
render: function() {
// Do something...
// Attach a subview to this view's element
var subView = new SubView({
el: this.$('.selector')
});
// Or...
subview.setElement(this.$('.selector'));
}
});
This allows views to directly pass
this.$('selector')
to a subview's constructor or directly to#setElement
: