tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.61k stars 193 forks source link

Add AttrMorph.prototype.clear and AttrMorph.prototype.destroy. #336

Closed rwjblue closed 9 years ago

rwjblue commented 9 years ago

These methods are called by renderAndCleanup (from template-utils) when an AttrMorph is created in a block helpers template:

    {{input type="checkbox" checked=checked}}

    {{#if checked}}
      <a href={{"http://google.com"}}>google.com</a>
    {{else}}
      <a href={{"http://yahoo.com"}}>yahoo.com</a>
    {{/if}}

In the above example, when checked is toggled the href AttrMorphs get .clear() and .destroy() called on them.

mixonic commented 9 years ago

Lgtm