[csswg-drafts] [css-mixins-1] Allow typed custom properties inside custom functions (#12317)

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

== [css-mixins-1] Allow typed custom properties inside custom functions ==
See: https://github.com/w3c/csswg-drafts/issues/12315

I also found it a bit surprising that there is no way to have local typed custom properties. (except `result`)

```css
@property --x {
  syntax: "<color>";
  inherits: true;
  initial-value: pink;
}

@function --foo() returns <color> {
  --x: rgb(255 0 0);
  
  result: if(
    style(--x: red): green;
    else: black;
  );
}

* {
  background-color: --foo(); /* black */
}
```

----

What was the original motivation to make everything untyped inside custom functions?

Because values are resolved in imaginary child elements nothing leaks out when a function is evaluated.
I can imagine that when the types are preserved it is possible to break custom functions by registering seemingly unrelated properties.

So maybe it should be possible to do local registrations?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12317 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 13:41:39 UTC