Views Flashcards
true/false Backbone views are used to tie models to the document.
TRUE
Do views handle dom events or model events?
both
How do you create views?
Extend Backbone.View Backbone.View.extend({});
What associated DOM element do views have at all times?
.el
How is a view defined?
It’s defined by the following…
Backbone.View.extend({ tagName: 'li', id: 'anything-you-want', className: 'hello-world', attributes: { 'data-value': 'hello' } });
How do you instantiate a view?
Views are instantiated by calling the constructor with the “new” keyword.
What’s the simplest example of instantiating a Backbone View?
new Backbone.View();
What will you normally pass to a view’s constructor?
a model
What does el reference?
The views DOM element
What is $el?
A cached jQuery wrapper around el
true/false $el is not cached
false
true/false Render is not a function that render’s the views element(.el)
false
What should render usually return?
this
How do you pass a model to a view?
Through the views constructor?
What are the 3 arguments to the make method?
Element to make, attributes to set on the element, and the value of the element.