You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spec does currently not describe any change to the var() substitution behavior. Hence I have been operating under the assumption that it works like in css-variables, except that instead of always substituting the specified value, you substitute a "synthetic" token stream equivalent to the computed value described in 2.4.
However, after reading issue #321, I think the spec definitely needs to deal with this explicitly.
<!-- --x is registered as <length> (inherited) -->
<div style="font-size: 10px; --x: 2em;">
<div style="font-size: 1px; height: var(--x);" id=inner></div>
</div>
What is the computed value of height on #inner in the example above? If we follow the current spec without reading between the lines, it's 2px. Probably, what we want is 20px. In any case, the spec should mention the correct behavior.
The text was updated successfully, but these errors were encountered:
I really want the typed value to be grammar-checked when subbed into real (or registered custom) properties, but I don't think I can reasonably do that without a ton of complexity. Combined with the resolution that registering a property must not cause a reparse of the stylesheet (any custom properties whose values violate the now-registered grammar just trigger invalid-at-computed-value-time), I think this is literally impossible to do.
I think I need to go back on my intent from #321 and just say that all custom properties substitute via token streams, regardless of registration status. The grammar just gives you a lot of useful abilities since we know the value's type (IDE/styleMap.set() error checking, computed value absolutization, animation, TypedOM representation...), but otherwise doesn't alter the behavior of variables.
However! I don't want to say that they retain their original token streams - that's an additional storage cost that's rather annoying, not to mention confusing in cases like what you provided. I need to instead define how to token-stream-ize a registered value, so it can be substituted in a reasonable manner.
Your example, then, would compute --x to a 20px value, which would then token-stream as a 20px dimension token, making the child's height 20px.
The spec does currently not describe any change to the var() substitution behavior. Hence I have been operating under the assumption that it works like in css-variables, except that instead of always substituting the specified value, you substitute a "synthetic" token stream equivalent to the computed value described in 2.4.
However, after reading issue #321, I think the spec definitely needs to deal with this explicitly.
What is the computed value of
height
on#inner
in the example above? If we follow the current spec without reading between the lines, it's2px
. Probably, what we want is20px
. In any case, the spec should mention the correct behavior.The text was updated successfully, but these errors were encountered: