webcomponents / polyfills

Web Components Polyfills
BSD 3-Clause "New" or "Revised" License
1.14k stars 165 forks source link

[ShadyCSS] Add support for calling `prepareTemplate` for a given name more than once. #19

Open sorvell opened 6 years ago

sorvell commented 6 years ago

This should provide better integration with [lit-html'(https://github.com/Polymer/lit-html)s shady-render functionality. Currently, @apply will not correctly track properties when prepareTemplate is called multiple times, losing the previously tracked properties for a given mixin.

schalkneethling commented 6 years ago

I second this. My usage is not in the same context but, not having to dynamically remove and create a new template element between each call to prepareTemplate would be great.

I know the flag _prepared is set on the template element[1] and if this is true the function bails. Perhaps one can pass { force: true } to indicate to the function that it should ignore the value of _prepared and do its thing again? I can see that being useful. Thanks!

[1] https://github.com/webcomponents/shadycss/blob/master/src/scoping-shim.js#L78

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.