- From: Brandon McConnell via GitHub <sysbot+gh@w3.org>
- Date: Thu, 13 Jun 2024 16:22:12 +0000
- To: public-css-archive@w3.org
@tabatkins Per your example, could we not simply omit a final value to default to `no-value`
<details><summary>Original example (with `no-value`)</summary>
<br>
```css
/* Original example (with `no-value`) */
background-color: if(
style(--variant: success): var(--color-success-60),
style(--variant: warning): var(--color-warning-60),
style(--variant: danger): var(--color-danger-60),
style(--variant: primary): var(--color-primary),
no-value
);
```
</details>
```css
/* Revised example (without `no-value`) */
background-color: if(
style(--variant: success): var(--color-success-60),
style(--variant: warning): var(--color-warning-60),
style(--variant: danger): var(--color-danger-60),
style(--variant: primary): var(--color-primary)
);
```
Omitting a final value would be equivalent to using `no-value` and may help to avoid introducing a new value:
```
<if()> = if(<condition>: [<declaration-value>]{1, N}; <optional-fallback-value>?)
```
Would this grammar paired with semicolon delimiters resolve the ambiguity here, so any of the below expressions are valid?
```css
/* no fallback value defined, equivalent of no-value */
if(style(--x: 1): 1, 2; style(--x: 2): 3);
/* fallback value defined as 4 */
if(style(--x: 1): 1, 2; style(--x: 2): 3; 4); /* 3 values: `1, 2`, `3`, and `4` */
/* not a primary syntax, but I suppose an empty valid could also pass, but it would be the same as the first example, omitting the value altogether */
if(style(--x: 1): 1, 2; style(--x: 2): 3; ); /* 2 values: `1, 2` and `3` */
```
--
GitHub Notification of comment by brandonmcconnell
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2166149568 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 13 June 2024 16:22:13 UTC