Re: [css-variables] Why we can not use 'var()' function for normal property

On Tue, Jun 2, 2015 at 3:59 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
> On Wed, Jun 3, 2015 at 10:45 AM, François REMY
> <francois.remy.dev@outlook.com> wrote:
>>
>> [2] We had this discussion so many times we should make a meme about it.
>> var(...) is replaced by the cascaded value, not the used value, so there is
>> no "implicit" dependency between any property at this point. This is exactly
>> similar to using a dummy variable to contain your value, except you don't
>> have to, which (1) makes your code easier to read, (2) allows you to reuse
>> existing css code/libraries. See Lea's email.
>
>
> IIRC, dbaron raised another concern about allowing normal properties to be
> used in var(), which is the performance, especially memory usage.
>
> Since var() can be used in any property, we have to store the token
> sequence. But for normal properties, the original string is dropped as far
> as it is parsed. Storing the token sequence would consume much more memory
> than only the parsed value, while it adds very few value to majority of
> pages. Even in pages which does need to use some normal properties in var(),
> they will only use very limited number of them. The rest stored tokens will
> be completely meaningless.

Yup, and reconstructing the value isn't feasible; our internal storage
of the value often loses important information like ordering, or can't
tell between specifying a default keyword or omitting it, etc.
There's no way for us to tell which types of information loss are
acceptable, and which will result in a secondary property using var()
to break, because you no longer match the second property's grammar.
(That is, two properties might have *similar* grammars for something,
and the form the author put into the stylesheet works in both, but the
form we reserialize to doesn't match the second property's grammar.)

~TJ

Received on Tuesday, 2 June 2015 23:05:20 UTC