[csswg-drafts] [css-mixins-1] Should parameters keep their type? (#12315)

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

== [css-mixins-1] Should parameters keep their type? ==
@kizu pointed out that the following behavior is surprising:

```
@function --f(--arg <color>) {
  result: if(
    style(--arg: red): green;
    else: black;
  );
}
/* --f(#f00) => black*/
```

At the time `if()` is resolved, we are treating `--arg` as an untyped local (step 11 of [evaluate a custom function](https://drafts.csswg.org/css-mixins-1/#evaluate-a-custom-function)), which means we don't interpret the right hand side of `style(--arg: red)` as a `<color>`, and therefore `rgb(255, 0, 0)` != `red`.

Grouping parameters in with (untyped) locals seemed reasonable to me originally, but given the example, I think `--arg <color>` should act as a "local registration" within the function (also affecting any locals named `--arg`). @tabatkins, @mirisuzanne: what do you think?

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


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

Received on Wednesday, 11 June 2025 09:13:34 UTC