- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Tue, 10 Sep 2024 11:39:12 +0000
- To: public-css-archive@w3.org
> But having comments looks even more hackier to me
If you don't want to use a "hacky" space/comment everywhere, you could also use an auxiliary variable, with an explanation of what's going on, and then just let all the consumers reference it.
```css
:root {
/* This sets `--valid-empty` to an empty value, this allows setting `--foo: var(--valid-empty)`
so that `var(--foo, hotpink)` resolves to an empty value instead of falling back to `hotpink`
or becoming invalid at computed-value time. */
--valid-empty: ;
}
.meow {
--foo: var(--valid-empty); /* <- Explicitly mark missing value as valid. */
color: var(--foo, hotpink); /* Resolves to `--foo` */
}
--
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10441#issuecomment-2340424746 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 10 September 2024 11:39:13 UTC