Skip to content

[css-mixins-1] Should parameters keep their type? #12315

Open
@andruud

Description

@andruud

@kizu pointed out that the following behavior is surprising:

@function --f(--arg <color>) {
  result: if(
    style(--arg: red): green;
    else: black;
  );
}
/* --f(#f00) => black*/

At the time if() is resolved, we are treating --arg as an untyped local (step 11 of evaluate a custom function), which means we don't interpret the right hand side of style(--arg: red) as a <color>, and therefore rgb(255, 0, 0) != red.

Grouping parameters in with (untyped) locals seemed reasonable to me originally, but given the example, I think --arg <color> should act as a "local registration" within the function (also affecting any locals named --arg). @tabatkins, @mirisuzanne: what do you think?

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