Skip to content

[css-mixins-1] What happens when a parameter is not given? #12796

@sesse

Description

@sesse

The spec says:

If passed a dashed-function, the arguments passed to the dashed-function are mapped to the mixin’s arguments; if more arguments are passed than the length of the mixin’s argument list, the @apply application does nothing. (Passing too few arguments is fine; the missing arguments take their default values instead.)

However, what if the missing arguments do not have default values? I can see three different interpretations:

  1. The entire @apply call is invalid, and is ignored (whether the parameter is ever used or not).
  2. Missing default values are treated as no @env for that parameter at all. This means you can use them in fallbacks (env(--missing-argument, blue) will return blue), but env(--missing-argument) with no fallback will be IACVT (unless an @env with the same name has been declared higher up in the chain, possibly by another mixin).
  3. Missing default values are treated as an @env with the guaranteed-invalid value, so you can use them in fallbacks like above but they will shadow any previous @env with the same name.

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