- From: Quentin Albert via GitHub <sysbot+gh@w3.org>
- Date: Mon, 10 Jun 2024 10:39:38 +0000
- To: public-css-archive@w3.org
Que-tin has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-cascade-6] Enable `revert-layer` layer limiting. == Currently `revert-layer` is [always allowed to roll back between origins](https://www.w3.org/TR/css-cascade-5/#revert-layer). It would if this could be limited via an argument. This way it would be possible to empty values instead of the initial values if no value is set in the previous author layers. Quote from the Specs: > Note: If there are no lower-priority declarations in the same [cascade origin](https://www.w3.org/TR/css-cascade-5/#origin) as the [revert-layer](https://www.w3.org/TR/css-cascade-5/#valdef-all-revert-layer) value, the [cascaded value](https://www.w3.org/TR/css-cascade-5/#cascaded-value) will roll back to the previous origin. That would be great in combination with the ability to define fallback values if no other value is found. Currently this can only be achieved with custom properties as they always roll back to an empty value. The following example will always revert to red, because there is no initial value for `--color`. ```css @layer example { p { --color: revert-layer; color: var(--color, red); } } ``` This on the other hand will always roll back to the inital UA styles ```css @layer example { p { color: revert-layer; } } ``` If one would only be able to provide a fallback value. This would still roll back to the UA styles as they are non empty. ```css @layer example { p { color: revert-layer(red); } } ``` So this would only make sense in the combination with a rollback limiter. It would make sense to be able to pass any layer name as well as the different origins. As origin names could clash with layer names this could be solved with introducing a new `env()`-Var. The syntax could look like the following: ```css @layer example { p { color: revert-layer(to env(UA), red); } } @layer example { p { color: revert-layer(to layer2, red); } } ``` This can be useful if you want to be able expose the opportunity to override certain properties on an element directly from a previous layer without a detour over custom-properties. This would feel way more natural. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10416 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 10 June 2024 10:39:39 UTC