polyfills icon indicating copy to clipboard operation
polyfills copied to clipboard

[ShadyCSS] Integration with Lit/HyperHtml - Dynamic Class Interpolation

Open egucciar opened this issue 7 years ago • 3 comments

We discovered an issue today in our application where we use hyperHtml and shadyCss extensively and successfully. We used a variable that changes dynamically over time to apply a class to a dom Element. When the class is updated, ShadyCSS styles are unfortunately cleared off.

My question here is - how do i force shadyCSS to re-apply styles to an element it thinks it has styled? I have tried the suspects - styleElement, styleSubtree and styleDocument but I believe there has to be some mechanism preventing shadyCSS from restyling certain elements. Any ideas what we could do better or differently here?

Our current workaround is not to use hyperHtml interpolation to set classes in the instance we discovered it, but we are wondering how this can be handled on a larger scale

egucciar avatar Jul 24 '18 21:07 egucciar

We have the same issue. We added an own helper method to re-apply "style-scope" and the tag name class "my-element" (e.g).

Example:

At the end this method returns the different class names plus "style-scope" and "my-element".

But this is not really a solution.

haugthom avatar Jul 27 '18 11:07 haugthom

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.

stale[bot] avatar Apr 22 '21 12:04 stale[bot]

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!

stale[bot] avatar Apr 27 '25 06:04 stale[bot]