IE11: Read/Update single variable
See original GitHub issueHey!
I’m searching for a way on how to read/edit a single css-variable with JS.
I can’t just reuse the cssVars function, as this would overwrite my other variables:
cssVars({ variables: { '--backgroundColor': value } });
Is there a way to make single updates or getting all current variables? Thanks in advance 😃
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top Results From Across the Web
React app is not working in IE 11 browser
I just tested on edge browser, npm start gives the same error you mentioned, but you say that you just want to run...
Read more >SCRIPT1003: Create React App and IE11 giving me ...
So I started updating react-scripts-ts to the latest version, which is 2.8.1. Fine! After solving a couple of issues it was very easy...
Read more >Apps with react-scripts v4.0.0 do not work in IE11 #9906
Describe the bug After upgrading my app from react-scripts 3.4.4 to 4.0.0 I see that app does not work in IE11 at all....
Read more >Reactive web app rendering in IE11
Our current workaround is to redirect IE users to a traditional web app with a single page informing them to open the link...
Read more >Rich Text Editor Control for React with IE 11 Support
Can anyone provide the other options available for the Rich Text Editor with React which supports IE 11? Thanks in advance. Update: I ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @bene-starzengruber.
Use the
options.onComplete
callback to access a list of all CSS custom properties.options.onlyLegacy
tofalse
tell the ponyfill to do this in both modern and legacy browsers,options.updateDOM
tofalse
to do a read-only (no changes to the DOM will be made).Use
options.variables
to add or modify CSS custom properties. See the Examples section for details.This will either add the
--my-color
CSS custom property or update its value if it already exists. All other CSS custom properties will remain unchanged.You can call
cssVars()
as many times as you like, passing only the custom properties you want to add or update tooptions.variables
. For performance reasons, it’s obviously better to call the ponyfill one time with many variables as opposed to multiple times with a single variable each time.If you want to 1) read a custom property value and then 2) change it based on its value, combine the two methods:
Fixed in 1.12.2.
Sorry about that. 1.12.1 fixed a separate but related bug. The bug you ran into was a regression introduced in 1.11.0. This has been fixed, and values passed to
options.variables
should now persist properly.New demo available here: