Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a component's template having directly nested live-binding sections. #1594

Merged
merged 4 commits into from Apr 3, 2015

Conversation

imjoshdean
Copy link
Contributor

Fixes #1593.

This fix makes sure that a component's template with "directly nested" live-binding sections like:

can.Component.extend({
  template: can.stache("{{#if foo}}<span/>{{/if}}")
})

Are able to be torn down when their parent component is removed from the page.

The fix was to give a component a nodeList that it passes to its template. When the component is removed, it will unregister its nodeList, which will teardown any "directly nested" live-binding sections.

While I was in can.Component, I consolidated the teardown code to work off only one "removed" event (or the control's destroyed event).

@justinbmeyer justinbmeyer self-assigned this Apr 2, 2015
@daffl daffl modified the milestone: 2.2.3 Apr 2, 2015
@daffl daffl changed the title #1593 issues with detached DOM sticking around in memory Issues with detached DOM sticking around in memory Apr 2, 2015
@justinbmeyer justinbmeyer changed the title Issues with detached DOM sticking around in memory Fixes a component's template having directly nested live-binding sections. Apr 3, 2015
@justinbmeyer justinbmeyer added this to the 2.2.3 milestone Apr 3, 2015
@daffl daffl removed this from the 2.2.3 milestone Apr 3, 2015
daffl added a commit that referenced this pull request Apr 3, 2015
Fixes a component's template having directly nested live-binding sections.
@daffl daffl merged commit e0b94ba into master Apr 3, 2015
@daffl daffl deleted the 1593_detachedDOM branch April 3, 2015 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOM appears to be held in memory in certain conditions with components rather than be destroyed
3 participants