172
rated 0 times
[
175]
[
3]
/ answers: 1 / hits: 26843
/ 11 Years ago, tue, april 23, 2013, 12:00:00
Why do the properties tagName
, id
and className
exist in a Backbone View?
More From » model-view-controller
Why do the properties tagName
, id
and className
exist in a Backbone View?
Those properties are used if your view has to create its own element, that is, if it doesn't have a el
attribute when instantiated (various reasons, I can go further in the matter). So you'll have a new element with the id id
, classes className
and attributes attributes
.
You can find the relevant piece of code here. This _ensureElement
method is used in the view's constructor.