Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-values-5] Inconsistent argument order between clamp() and mix()/progress() #11427

Open
cr7pt0gr4ph7 opened this issue Jan 2, 2025 · 1 comment

Comments

@cr7pt0gr4ph7
Copy link

cr7pt0gr4ph7 commented Jan 2, 2025

The argument order for the newly proposed progress() / mix() functions differs from that of the already existing clamp() function:

/* Source: https://drafts.csswg.org/css-values/#comp-func */
clamp(<lower-bound>, <value>, <upper-bound>)

/* Source: https://drafts.csswg.org/css-values-5/#mix (arguments renamed to illustrate the point) */
mix(<value>, <lower-bound>, <upper-bound>)
mix(<value> of <keyframes-name>)

/* Source: https://drafts.csswg.org/css-values-5/#progress-func (arguments renamed to illustrate the point) */
progress(<progress>, <lower-bound>, <upper-bound>)

From my (limited) viewpoint, this is a potential source of confusion of stylesheet authors. There are good arguments either way (mix(<lower-bound>, <value>, <upper-bound>) would be consistent with clamp(<lower-bound>, <value>, <upper-bound>), while
mix(<lower-bound>, <min>, <upper-bound>) would be more symmetric with mix(<value> of <keyframes-name>). It would probably make sense to include a note about the inconsistency as well as the rationale for the choice made in the spec to prevent a bit of avoidable confusion in the future.

Possibly related: #10489

@Loirooriol
Copy link
Contributor

You say "arguments renamed for claritity" but the arguments represent completely different things so I don't really think these are comparable situations where consistency would be expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants