Re: [csswg-drafts] [css-values] Add `valid-empty`-like value (for CSS Custom Properties) (#10441)

> 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