Skip to content

[css-values-5][css-mixins-1] Add an if-test for local variables #11455

Closed
@andruud

Description

@andruud

Within a custom function, var() can refer to a local variable / parameter, e.g:

@function --add-one(--x) {
  result: calc(var(--x) + 1px);
}

The if() function has a style() test, which accepts a <style-query>. We should have a test which can reach local variables / parameters as well, such that you can do e.g.:

@function --select(--option) {
  result: if(
    test(--option: one): foo; 
    test(--option: two): bar;
    else: baz;
  );
}

One option could be to spec that if(style()) targets locals within a function context (i.e. it sees the same thing var() sees), but this might stretch the definition of "style". Otherwise, I guess we'll need to invent a new test.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday afternoon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions