this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
this.el = this.$el[0];
What does Backbone.$ mean in the code snippet below ? is it the Jquery reference to backbone ?
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
this.el = this.$el[0];
What does Backbone.$ mean in the code snippet below ? is it the Jquery reference to backbone ?
update: el instanceof Backbone.$
mean check if el
is jQuery/zepto object or not. Backbone.$
is backbone variable and used as alias for jQuery/zepto.
from the doc http://backbonejs.org/#View-dollar
If jQuery is included on the page, each view has a
$
function that runs queries scoped within the view's element. If you use this scoped jQuery function, you don't have to use model ids as part of your query to pull out specific elements in a list, and can rely much more on HTML class attributes. It's equivalent to running:view.$el.find(selector)