- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Tue, 10 Oct 2023 18:31:37 +0000
- To: public-css-archive@w3.org
LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-values] Idea to make "`var()` for regular properties" implementable == The discussion in #7707 gave me an idea. We have this frequent author request for `var()` to work with regular properties, which we cannot do because cycles (though we have resolved for an ancestor version, see #2864 ). However, the issues only occur for a small subset of properties, different for each property. For many properties any property would be fine except themselves (and any of their longhands). So what if we could simply restrict the dependency graph by restricting which properties are allowed based on the property `var()` is used on? For example, the use case in #7707 in the simple case (single radii, single box model metrics) can be done like: ```css border-radius: calc( inherit(border-radius) - inherit(padding) - inherit(border-width) - var(margin) ); ``` (The complex case would simply require four of these) Some cycle detection would still be needed, to detect cycles with more than 1 step, like: ```css background: var(color); color: var(background); ``` We'd still need to figure out serialization, but we need to do that for `inherit()` anyway. Yes, this requires high effort, and is a very complex feature, however there is also very high value. This together with `inherit()` would unlock **a ton** of use cases (I can list them if non-obvious, but wanted to check feasibility first). Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9454 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 10 October 2023 18:31:39 UTC