[csswg-drafts] [css-mixins] Polymorphism for custom functions (#12493)

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

== [css-mixins] Polymorphism for custom functions ==
The [spec](https://drafts.csswg.org/css-mixins/#function-preamble) currently has this to say:

> The name of a `@function` rule is a [tree-scoped name](https://drafts.csswg.org/css-scoping-1/#css-tree-scoped-name). If more than one `@function` exists for a given name, then the rule in the stronger cascade layer wins, and rules defined later win within the same layer.

That means, declarations with the same *function name* compete with each other and only a single one can be used within a given context, regardless of any differences in defined parameters. 

For several predefined functions, CSS supports some kind of polymorphism, e.g. `rgb()`: with and without alpha, percentages or numbers, comma separation or none/slash. 

Would it be possible and desirable to support something similar for custom functions as well? 

That means, the *function preamble*, i.e. the name, the number of parameters and their types, would need to be identical for `@function` declarations to compete at all. 

PS: I’m sorry if this has already been considered and rejected, but searching for “polymorphism” did not turn up anything.

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


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

Received on Thursday, 17 July 2025 16:17:20 UTC