Skip to content

[css-mixins-1] Let 'inherit' work like 'inherit()' #12387

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

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

andruud
Copy link
Member

@andruud andruud commented Jun 23, 2025

With @function, it becomes possible to have a "type mismatch" between an "outer" custom property and an "inner" custom property:

@property --x {
  syntax: "auto | red";
  /* ... */
}

@function --f(--x <color>: inherit) {
  result: var(--x);
}

div {
  --x: red;
  --result: --f(); /* => ? */
}

We have to address this somehow, and the obvious way seems to be making 'inherit' behave like "a var(--x) that resolves in the parent stack frame". This is essentially what inherit() does, which already exists in the spec.

With @function, it becomes possible to have a "type mismatch"
between an "outer" custom property and an "inner" custom property:

  @Property --x {
    syntax: "auto | red";
    /* ... */
  }

  @function --f(--x <color>: inherit) {
    result: var(--x);
  }

  div {
    --x: red;
    --f(); /* => ? */
  }

We have to address this somehow, and the obvious way seems to be
making 'inherit' behave like "a var(--x) that resolves in the parent
stack frame". This is essentially what inherit() does, which already
exists in the spec.
@tabatkins tabatkins merged commit f040a65 into w3c:main Jun 23, 2025
1 check passed
@andruud andruud deleted the inherit_function branch June 24, 2025 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants