- From: Denilson Sá Maia via GitHub <noreply@w3.org>
- Date: Mon, 21 Jul 2025 08:57:23 +0000
- To: public-svg-issues@w3.org
denilsonsa has just created a new issue for https://github.com/w3c/svgwg: == Suggestion: explicitly mention if CSS variables are supported inside presentation attributes == See the demo and the text: https://codepen.io/denilsonsa/pen/ogjbRwa In a nutshell, I expect CSS variables to be available inside CSS style sheets. Thus, if I'm doing `style="fill: var(--foo-bar)"`, I expect it to work. And indeed it does work. It's CSS after all. But what if I use `fill="var(--foo-bar)"`? Would it work? My intuition says it wouldn't work, because the attribute is outside the CSS world. And yet, my intuition is wrong, CSS variables seem to be supported inside presentation attributes in SVG. But where is this defined? Well, I spend a couple of hours trying to find it in the specs, and I couldn't. The closest I found was [Attribute syntax](https://svgwg.org/svg2-draft/types.html#presentation-attribute-css-value), where it says (some) values are parsed according to the CSS grammar. It even provides an example using CSS comments inside a value. But there is no mention of CSS variables. I even searched the [single page spec](https://svgwg.org/svg2-draft/single-page.html) for `variable` or `var(`, and I found nothing. --- Suggestions: * Please explicitly define that CSS variables are expected to be supported inside presentation attributes. It could even be a little "Note" box, since this could be a consequence of something else defined somewhere else. * (bonus) Please update MDN about CSS variables inside SVG presentation attributes. (Yes, I know, MDN is outside the scope of the specs; but hopefully some kind soul will update MDN regarding CSS variables in SVG attributes.) Please view or discuss this issue at https://github.com/w3c/svgwg/issues/987 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 21 July 2025 08:57:24 UTC