Re: [csswg-drafts] [css-variables] Substitution of invalid variables into other variables (#4075)

Yeah, there's limits on how close we can get, definitely. Thus "as close as possible".

The general principle is to make registered custom properties act more like built-in properties when possible, and make unregistered act like registered when possible, to reduce the overall cognitive load.  Built-ins can grammar-check at parse-time and get richer error recovery (falling back to the previous value in the cascade), which custom properties aren't capable of. But if you force a built-in property to delay grammar checking until computed-value time (by using a `var()` in it), then if it violates its own grammar it becomes `unset`; thus registered properties should ideally do the same.

And yeah, I do think that cyclic properties becoming the guaranteed-invalid value to help in realizing errors is a better behavior, despite it technically being a behavior difference from built-ins. Built-ins can only go cyclic amongst themselves in rare cases ('em' in font-size, %s in sizing properties sometimes, etc), and handle it in bespoke ways, so there's no consistent behavior to start from, and adding *another* bespoke error behavior isn't making the situation any worse than it already is. ^_^

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

Received on Friday, 27 March 2020 17:54:32 UTC