3 ms·
You don't have to specify those things in a View if you don't want to, by simply telling the View what element to attach to: new View({el: domElement}) ..
by jashkenas 14y ago
You don't have to specify those things in a View if you don't want to, by simply telling the View what element to attach to:
new View({el: domElement})
... but it's part of Backbone's goals -- which are further explained towards the end of the video -- that a given view has an element at all times, even before any templates may or may not have been rendered.
Always having an element means that you can worry less about view state. If all of your DOM events are delegated from the root element, you don't have to worry about whether the template has been rendered yet, which particular template might have been rendered, whether the data is available yet, and so on... The events continue to work regardless.