title: Reassign Backbone View to newly created DOM element
body: <p>I'm creating a search results page using Backbone in combination with CoffeeScript and Handlebars. I have two views: one for the list of results (ListView) and the second view is for a single result (ResultView). Simplified code:</p>
  
  <pre><code>ListView = Backbone.View.extend
    el: $("ul#results")
    ...
  
    addItem: (result) -&gt;
      resultView = new ResultView({
        model: result
      })
      resultView.parentView = this
      this.el.append(resultView.render().el)
  
  ResultView = Backbone.View.extend
    tagName: "li"
    className: "result"
    events:
      ...
  </code></pre>
  
  <p>Short explanation:</p>
  
  <ul>
  <li>The ListView is assigned to <code>ul#results</code></li>
  <li>When a result is added to the listview, a ResultView is created, that has knowledge of its parent and renders itself</li>
  <li>For the ResultView an element <code>li.result</code> is created (default Backbone behaviour)</li>
  </ul>
  
  <p>This is (simplified) the template I'm using to render a search result:</p>
  
  <pre><code>&lt;li class="result"&gt;
     &lt;h1&gt;
       &lt;a href="{{link}}"&gt;{{title}}&lt;/a&gt;
     &lt;/h1&gt;
     &lt;p&gt;{{snippet}}&lt;/p&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Here's my conundrum, as you may have discovered yourself: I define a <code>li.result</code> in my Backbone ResultView, <em>and</em> in my template. What I <em>can't</em> do:</p>
  
  <ul>
  <li>Bind the ResultView to the <code>li.result</code> in my template because it doesn't exist yet in the DOM</li>
  <li>Remove the <code>li.result</code> from my template, because I still need it to render the page server side for those who don't have JavaScript enabled</li>
  </ul>
  
  <p>Is there a way to (elegantly) re-assign a Backbone view to an element after its been instantiated? Or put simply, can I reference ResultView to a temporary element, render the template and then move it into <code>ul#result</code>? Or am I looking at it the wrong way?</p>
  
  <p>Thanks!</p>