Skip to content

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

Open
@cr7pt0gr4ph7

Description

@cr7pt0gr4ph7

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions