W3C home > Mailing lists > Public > www-style@w3.org > June 2015

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

From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Wed, 3 Jun 2015 10:59:22 +1200
Message-ID: <CAMdq698PpJt+wvPpfaAUk71bAX4tY=4fQsRGOvV7QuV6inLGFg@mail.gmail.com>
To: Fran├žois REMY <francois.remy.dev@outlook.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Boris Zbarsky <bzbarsky@mit.edu>, Marat Tanalin <mtanalin@yandex.ru>, www-style list <www-style@w3.org>
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.

- Xidorn
Received on Tuesday, 2 June 2015 23:00:29 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:54 UTC