Re: [csswg-drafts] [css-env] Consider value-level parsing like calc() rather than token-level like var()

> I don't think this is possible. calc() can be value-level because it resolves to a single leaf value in the grammars. The built-in env()s already have things that resolve to multiple values, however, and we don't have productions to recognize those.

Can you put an example? All env vars that I know of are either lengths or times. And all the ones that are in the spec are only lengths.

> However, the "infection" behavior of var() isn't quite present here. You don't have to wait for any other values to be set up before you resolve it; you can just sub it in during parsing, and then invalidate the thing it's used in like normal. My current plan for author-defined env() is to just provide a JS API too (not a CSS rule), so that invariant will be maintained anyway. Should I make that clearer in the spec, to help guide implementation?

This is not quite true, that's now how it works in any browser today. All browsers reuse the custom property machinery because well, these values do change, semi-frequently actually, due to the rotation of the device for example. And nobody wants to reparse CSS rules when something in the page changes, and less so when a author-accessible API is called.

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

Received on Monday, 5 November 2018 23:27:30 UTC