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

Blaze.remove doesn't remove DOM nodes when Blaze.renderWithData is used to create the template #3130

Closed
davidworkman9 opened this issue Nov 19, 2014 · 3 comments · Fixed by #3261

Comments

@davidworkman9
Copy link
Contributor

Reproduction here

@n1mmy n1mmy added the Blaze label Nov 19, 2014
Slava added a commit that referenced this issue Dec 9, 2014
autogenerated parents those need to be gc'd with their children.
Should help with #3130
Slava added a commit that referenced this issue Dec 9, 2014
@Slava
Copy link
Contributor

Slava commented Dec 9, 2014

Hi @davidworkman9, thanks for this report and a very clear reproduction. I submitted a fix in #3261, waiting for a review from the Blaze team :)

@davidworkman9
Copy link
Contributor Author

Thanks :)

dgreensp added a commit that referenced this issue Dec 9, 2014
If you Blaze.remove a View that is a template rendered by Blaze.renderWithData, or included with an implicit “with” as in `{{> myTemplate someData}}`, Blaze will now remove the DOM of the template, and also remove the implicit “with” (in both cases).

As background, Blaze.remove only works on Views that were attached directly under a DOM element, not inside another View.  Blaze.render always attaches the resulting View directly under a DOM element, but Blaze.renderWithData creates a “with” View around the template View.  Previously, you could Blaze.remove the “with” View (which is returned by renderWithData), but if you got access to the template’s View some other way and tried to remove it directly, nothing would happen.  Now, the correct thing happens (the View is destroyed and the DOM is removed).

In the future, we should consider whether Blaze.remove should work on arbitrary Views, not just Views attached under a DOM element.
@dgreensp
Copy link
Contributor

dgreensp commented Dec 9, 2014

Fixed on devel.

martijnwalraven pushed a commit that referenced this issue Feb 22, 2016
autogenerated parents those need to be gc'd with their children.
Should help with #3130
martijnwalraven pushed a commit that referenced this issue Feb 22, 2016
If you Blaze.remove a View that is a template rendered by Blaze.renderWithData, or included with an implicit “with” as in `{{> myTemplate someData}}`, Blaze will now remove the DOM of the template, and also remove the implicit “with” (in both cases).

As background, Blaze.remove only works on Views that were attached directly under a DOM element, not inside another View.  Blaze.render always attaches the resulting View directly under a DOM element, but Blaze.renderWithData creates a “with” View around the template View.  Previously, you could Blaze.remove the “with” View (which is returned by renderWithData), but if you got access to the template’s View some other way and tried to remove it directly, nothing would happen.  Now, the correct thing happens (the View is destroyed and the DOM is removed).

In the future, we should consider whether Blaze.remove should work on arbitrary Views, not just Views attached under a DOM element.
martijnwalraven pushed a commit that referenced this issue Feb 22, 2016
martijnwalraven pushed a commit that referenced this issue Feb 22, 2016
If you Blaze.remove a View that is a template rendered by Blaze.renderWithData, or included with an implicit “with” as in `{{> myTemplate someData}}`, Blaze will now remove the DOM of the template, and also remove the implicit “with” (in both cases).

As background, Blaze.remove only works on Views that were attached directly under a DOM element, not inside another View.  Blaze.render always attaches the resulting View directly under a DOM element, but Blaze.renderWithData creates a “with” View around the template View.  Previously, you could Blaze.remove the “with” View (which is returned by renderWithData), but if you got access to the template’s View some other way and tried to remove it directly, nothing would happen.  Now, the correct thing happens (the View is destroyed and the DOM is removed).

In the future, we should consider whether Blaze.remove should work on arbitrary Views, not just Views attached under a DOM element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants