Open tabatkins opened 2 months ago
Arbitrary substitution functions can be used in place of any part of a value in any property on an element.
UAs (at least Chrome and FF) already accept var()
and env()
in descriptors of page and margin rules, including size
, ie. a descriptor whose name and grammar do not match those of a property.
I suggest that:
<env()>
should be valid for all declarations<var()>
should be valid for all declarations in element and cascade-dependent contexts<attr()>
, <random-item()>
, should be valid in element-dependent contexts(edit) Reference for the next comment: https://github.com/w3c/csswg-drafts/issues/5969#issuecomment-1216433727
@tabatkins I read through it, LGTM.
UAs (at least Chrome and FF) already accept var() and env() in descriptors of page and margin rules
@cdoublev Huh. Looking briefly at the Blink code (StyleResolver::StyleForPage), I think var()
would resolve against the root element. I don't think that's per spec.
It's a separate issue, though.
In Variables, we have a lot of text defining how to handle a function that can be replaced by an arbitrary token sequence. In Values 5, we're adding several more functions that act similarly. I ended up just referencing the (undefined) concept of an "arbitrary substitution function", and had an issue saying I needed to define it in Variables at some point. Mixins also needs to reference this concept, for custom functions.
Well, I've defined it (in the commit that'll be referenced from this issue in a moment). Please review?
Notably, the only actually new text is the algorithms for "resolve a var() function" and "substitute an arbitrary substitution function"; the rest of the commit is just rearranging text and rephrasing some things to refer to the new generic term rather than be var()-specific.
Assuming this looks good, I'll need to follow up with some edits to Values 5 and to Mixins, to define resolution algorithms.
(Because of the text movement, reviewing the diff might be difficult; I recommend just checking the live Variables spec.)