[csswg-drafts] [css-values-5][css-mixins-1] Add an if-test for local variables (#11455)

andruud has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values-5][css-mixins-1] Add an if-test for local variables ==
Within a [custom function](https://drafts.csswg.org/css-mixins-1/#defining-custom-functions), `var()` can refer to a local variable / parameter, e.g:

```
@function --add-one(--x) {
  result: calc(var(--x) + 1px);
}
```

The [if()](https://drafts.csswg.org/css-values-5/#if-notation) function has a [`style()` test](https://drafts.csswg.org/css-values-5/#typedef-if-test), which accepts a `<style-query>`. We should have a test which can reach local variables / parameters as well, such that you can do e.g.:

```
@function --select(--option) {
  result: if(
    test(--option: one): foo; 
    test(--option: two): bar;
    else: baz;
  );
}
```

One option could be to spec that `if(style())` targets locals within a function context (i.e. it sees the same thing `var()` sees), but this might stretch the definition of "style". Otherwise, I guess we'll need to invent a new test.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11455 using your GitHub account


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

Received on Tuesday, 7 January 2025 20:21:24 UTC