Merge pull request #2716 from braddunbar/template-docs

Add docs for the View#template convention.
This commit is contained in:
Jeremy Ashkenas
2013-09-11 10:21:50 -07:00

View File

@@ -427,6 +427,7 @@
<li> <a href="#View-setElement">setElement</a></li>
<li> <a href="#View-attributes">attributes</a></li>
<li> <a href="#View-dollar">$ (jQuery)</a></li>
<li> <a href="#View-template">template</a></li>
<li> <a href="#View-render">render</a></li>
<li> <a href="#View-remove">remove</a></li>
<li> <a href="#View-delegateEvents">delegateEvents</a></li>
@@ -2616,6 +2617,21 @@ ui.Chapter = Backbone.View.extend({
};
}
});
</pre>
<p id="View-template">
<b class="header">template</b><code>view.template([data])</code>
<br />
Conforms loosely to the result of Underscore's
<a href="http://underscorejs.org/#template"><b>template</b></a>
function, returning an HTML representation of the view. While not
provided by the library, <b>template</b> is an oft-used convention.
</p>
<pre>
var View = Backbone.View.extend({
template: _.template(…)
});
</pre>
<p id="View-render">