Skip to content

Commit f040a65

Browse files
authored
[css-mixins-1] Let 'inherit' work like 'inherit()' (#12387)
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.
1 parent b3a00e8 commit f040a65

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

css-mixins-1/Overview.bs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,29 @@ with its [=function parameters=] overriding "inherited" custom properties of the
633633
is the [=guaranteed-invalid value=].
634634

635635
* On custom properties,
636-
the [=CSS-wide keywords=] ''initial'' and ''inherit'' have their usual effect;
637-
all other [=CSS-wide keywords=] resolve to the [=guaranteed-invalid value=].
636+
the [=CSS-wide keywords=] have the following effects:
637+
638+
<dl>
639+
<dt>''initial''</dt>
640+
<dd>
641+
Resolves to the initial value of the custom property
642+
within |registrations|.
643+
</dd>
644+
645+
<dt>''inherit''</dt>
646+
<dd>
647+
Resolves like an ''inherit()'' function
648+
with the custom property name as its one and only argument.
649+
650+
Note: This ensures that a [=function parameter=] defaulted to ''inherit''
651+
is reinterpreted using the local [=parameter type=].
652+
</dd>
653+
654+
<dt>any other [=CSS-wide keyword=]</dt>
655+
<dd>
656+
Resolves to the [=guaranteed-invalid value=].
657+
</dd>
658+
</dl>
638659

639660
Note: ''initial'' references the [=custom property registration=]
640661
created from the [=function parameters=],

0 commit comments

Comments
 (0)