Skip to content
This repository was archived by the owner on Apr 4, 2019. It is now read-only.

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

Merged

Conversation

rwjblue
Copy link
Collaborator

@rwjblue rwjblue commented May 5, 2015

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.

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

```javascript
    {{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
Copy link
Collaborator

mixonic commented May 5, 2015

Lgtm

rwjblue added a commit that referenced this pull request May 5, 2015
Add AttrMorph.prototype.clear and AttrMorph.prototype.destroy.
@rwjblue rwjblue merged commit 4ca74f3 into tildeio:master May 5, 2015
@rwjblue rwjblue deleted the add-clear-and-destroy-to-attr-morph branch May 5, 2015 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants