question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do we need to provide all variables with cssVars.variables? (IE11)

See original GitHub issue

I have created a small Angular sample application including css-vars-ponyfill that I’m currently testing on IE11. It contains a title, a button to toggle the fontweight of the title, and a colorpicker to change the color of the title.

cssVars is initialized by calling:

cssVars({
   watch: true,
   onlyLegacy: true
})

The variables are:

--fontWeight: bold;
--fontColor: red;

In the methods to update the color or title I simply call e.g. cssVars(variables:{"--fontColor", "blue"}); to update the color. Which works fine, but everytime I update one of the variables, the other gets reset to it’s original value!

Is is necessary to call cssVars with variables containing all variables? This would be a bit of an overkill for larger applications…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jhildenbiddlecommented, Feb 15, 2020

@Selupsis, @nkamenar, @itsthechad

I have fixed this issue and will publish an update very soon.

For those interested, the issue was more complex than the workaround (#110) provided by @itsthechad would suggest. The workaround forced options.variables values to always persist, which breaks ponyfill calls made when updateDOM is false. This probably seems like an edge case, but it’s critical for supporting web components since updateDOM:false is used under the hood to process shadowRoot :root declarations without affecting the regular DOM.

Thank you for your patience with this issue and apologies (again) for the slow response. Special thanks to @itsthechad providing the workaround while I was navigating the relocation!

1reaction
Selupsiscommented, Jan 14, 2020

@itsthechad Thanks for the workaround, I can confirm that it works. I’ll be using it until there will be a patch for this issue ^^

Read more comments on GitHub >

github_iconTop Results From Across the Web

IE11 - does a polyfill / script exist for CSS variables?
Yes, so long as you're processing root-level custom properties (IE9+). GitHub: https://github.com/jhildenbiddle/css-vars-ponyfill ...
Read more >
How to use CSS custom properties (a.k.a. variables)
Note: CSS variables are not and won't be supported in IE11. You can either create a static stylesheet for all UA browsers or...
Read more >
CSS variables (Custom Properties) polyfill for IE11
It searches for all rules containing variable getters and setter, remembers the affected selectors so future affected Elements can be found in a...
Read more >
CSS Variables (Custom Properties) | Can I use... Support ...
CSS Variables (Custom Properties). - CR. Permits the declaration and usage of cascading variables in stylesheets. Usage % of. all users, all tracked ......
Read more >
Why I Don't Use CSS Variables
CSS variables, officially called Custom Properties, are amazing. I want to use them, but I can't. Because IE11 doesn't support them.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found