-
Notifications
You must be signed in to change notification settings - Fork 99
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
Support for CSS custom properties #129
Comments
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
I'm not sure the exact purpose of CSS variables when you are working in a language that has variables. It seems like this is a 2nd way to do things we can already do differently, except now without any compiler help for types and typos. I'm not against doing this particularly, but so far I have not seen any cases that definitively show that this is a good thing to have. I prefer to use GitHub for bugs, not feature requests, so I will close. |
@evancz This isn´t a feature request, this is a bug report. Though I might be too polite to describe it as such. This library is missing a feature that is a part of the CSS standard. I´m not familiar with the mindset behind the library, but my initial expectation is that it supports the standard that exists. |
@evancz I found this bug while trying to pass an |
I believe that in the virtual dom source at line 509 (https://github.com/elm-lang/virtual-dom/blob/master/src/Elm/Kernel/VirtualDom.js#L509), if domNodeStyle[key] = styles[key] was replaced with domNodeStyle.setProperty(key, styles[key]) then custom variables would work. CSS custom properites are designed to be used in JavaScript (see https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables#Values_in_JavaScript) and I think it would be really useful if elm allowed custom properties to be set. Many thanks for the great libary :) |
When using custom css properties the syntax `style.property = 'value'` does not work for custom css properties. Using `style.setProperty()` instead allows custom css properties to be used. Fixes elm-lang/html/issues/129
CSS has Custom Properties which can be used both in a CSS file as well as an inline style.
A custom property has the following signature:
--*
.This does not appear to be supported by
Html.Attributes.style
?I'm using the following code,
applied like
div [ applyTheme theme ] []
.This produces no style attribute on the element. Other CSS properties do.
Would it be possible to add support for this?
https://www.w3.org/TR/css-variables/
The text was updated successfully, but these errors were encountered: