Permalink
Browse files

Merge commit 'f5db307a70df6a64cd6c94aa64e77f5d418400ce' into gh-pages

* commit 'f5db307a70df6a64cd6c94aa64e77f5d418400ce':
  Fixes #232
  • Loading branch information...
2 parents 966763b + f5db307 commit 991aa8deb302edefcb02992eebd38764cfa1f408 @addyosmani committed Dec 23, 2012
Showing with 7 additions and 9 deletions.
  1. +5 −6 index.html
  2. +2 −3 index.md
View
@@ -5418,25 +5418,24 @@ <h3 id="boilerplate-rendering-code"><a href="#TOC">Boilerplate Rendering Code</a
&lt;div class=&quot;row&quot;&gt;
&lt;label&gt;First Name:&lt;/label&gt;
&lt;span&gt;&lt;%= firstName %&gt;&lt;/span&gt;
- &lt;div&gt;
+ &lt;/div&gt;
&lt;div class=&quot;row&quot;&gt;
&lt;label&gt;Last Name:&lt;/label&gt;
&lt;span&gt;&lt;%= lastName %&gt;&lt;/span&gt;
- &lt;div&gt;
+ &lt;/div&gt;
&lt;div class=&quot;row&quot;&gt;
&lt;label&gt;Email:&lt;/label&gt;
&lt;span&gt;&lt;%= email %&gt;&lt;/span&gt;
- &lt;div&gt;
+ &lt;/div&gt;
&lt;/script&gt;
&lt;/pre&gt;</code></pre>
<pre class="sourceCode javascript"><code class="sourceCode javascript"><span class="kw">var</span> MyView = <span class="kw">Backbone.View</span>.<span class="fu">extend</span>({
- <span class="dt">template</span>: <span class="ch">&#39;#my-view-template&#39;</span>,
+ <span class="dt">template</span>: $(<span class="ch">&#39;#my-view-template&#39;</span>).<span class="fu">html</span>(),
<span class="dt">render</span>: <span class="kw">function</span>(){
<span class="co">// compile the Underscore.js template</span>
- <span class="kw">var</span> template = $(<span class="ch">&#39;#my-view-template&#39;</span>);
- <span class="kw">var</span> compiledTemplate = <span class="kw">_</span>.<span class="fu">template</span>(template);
+ <span class="kw">var</span> compiledTemplate = <span class="kw">_</span>.<span class="fu">template</span>(<span class="kw">this</span>.<span class="fu">template</span>);
<span class="co">// render the template with the model data</span>
<span class="kw">var</span> data = <span class="kw">this</span>.<span class="fu">model</span>.<span class="fu">toJSON</span>();
View
@@ -6816,13 +6816,12 @@ Consider the code that it typically requires to render a view with Backbone and
```javascript
var MyView = Backbone.View.extend({
- template: '#my-view-template',
+ template: $('#my-view-template').html(),
render: function(){
// compile the Underscore.js template
- var template = $('#my-view-template');
- var compiledTemplate = _.template(template);
+ var compiledTemplate = _.template(this.template);
// render the template with the model data
var data = this.model.toJSON();

0 comments on commit 991aa8d

Please sign in to comment.