What is use of tagName, id, and className properties in Backbone View? While we can access dom element with el

backbone.js, javascript, model-view-controller

Solution

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.

Problem

Why do the properties `tagName`, `id` and `className` exist in a Backbone View?

Original source