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

[1.x] Ensure template instance isn't cached on prototype. Fixes #5096 #5102

Merged
merged 4 commits into from
Feb 8, 2018

Conversation

kevinpschaaf
Copy link
Member

Templatizer was incorrectly caching the <template> element from the first call to templatize on the templatizer constructor's prototype, which then leaked it but more importantly its dataHost (plus anything else up the tree linked via dataHost). Since the templatizer constructor is cached on the _content (which is then cached in the prototypical _notes of a custom element prototype), this resulted in an arbitrary amount of dom instances being retained via the custom element prototype.

This fix instead caches a "clone" of the template without any of the instance-time references like dataHost on the cached constructor.

Reference Issue

Fixes #5096

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and easy fix, I like it!

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.

4 participants