Re: [csswg-drafts] [css-values-4] Allow an inline way to do "first value that's supported" (#5055)

> > Or, if we keep it as a function, perhaps we can relax the restriction to "only one of these per declaration"? So that one could do things like:
> 
> We had literally this exact case today, with the gradient interpolation that we wanted to resolve into a “space” when it is not supported. Having an ability to use the `first-supported()` inside the value would be great.

I suspect there are many, many such cases where the potentially unsupported part of a value is a tiny fraction of it.

This reminds me, in that case it should also support empty tokens, so one can do things like `linear-gradient(to right first-supported(in oklch, red, lime)`.

> I guess the main issue with this will be that it should be invalid as a value for non-registered custom properties, so there won't be a way for the authors to specify two instances of it in the runtime? Or we will be ok with making the declaration invalid at computed-value time when we encounter the second instance of the `first-supported()` in some declaration?

I think the latter is far more flexible. Making it invalid in custom properties reduces its utility quite a lot.

-----

Also, any chance we could call it `supported()`? I think that's equally clear, and much more succinct.

-- 
GitHub Notification of comment by LeaVerou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5055#issuecomment-2135858607 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 28 May 2024 18:19:58 UTC