Re: [csswg-drafts] [css-variables] Should `var(var(--x))` work? (#11144)

Bumped into this today while trying to implement the Arbitrary Substitution Function concept. I don't know how useful my opinion is but I'll add it anyway. 😅 

- Intuitively I expected ASFs to be able to go inside any part of another ASF, which is how I ended up finding this issue in the first place.
- Grammar checking ASFs at parse time didn't seem to have much benefit. IMO it's clearer to authors if using an ASF always makes the declaration valid and cascaded until it's checked at computed-value time.
- What Tab's proposed seems to solve a lot of issues and I don't see any problems with it. (Though admittedly not all the details are entirely clear in my head.)
- Defining an algorithm for substituting depth-first is probably not going to be fun, but it'd be nice to have it also be more concrete. The current algorithm's "For each arbitrary substitution function func in value:" is a bit vague for my liking. Maybe this isn't true in all engines, but at least in Ladybird the internal representation for a declaration value containing ASFs is the list of component-values, and I assume other engines do something similar. In which case it could be written in terms of iterating through CVs.

-- 
GitHub Notification of comment by AtkinsSJ
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11144#issuecomment-2700859254 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 5 March 2025 12:57:20 UTC