W3C home > Mailing lists > Public > www-style@w3.org > September 2012

Re: [css-variables] Feature detection and 'variables' (Issue 2)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 6 Sep 2012 11:16:36 -0700
Message-ID: <CAAWBYDA0XEr6KcJXNo3MutD6EPYKuJZMh2qoL4E+YH7Q444S9w@mail.gmail.com>
To: François REMY <fremycompany_pub@yahoo.fr>
Cc: CSS WG <www-style@w3.org>
On Thu, Sep 6, 2012 at 2:45 AM, François REMY <fremycompany_pub@yahoo.fr> wrote:
> The introduction of property references may mean we lost the ability to
> target browser by feature detection.

I don't understand what you mean here.  Can you elaborate what the
problem is that's introduced by Variables?

> Since ‘variables’ are resolved at
> computation time, it’s not possible at this time to provide ‘fallback
> values’ in the case a property doesn't recognize the value stored in a valid
> custom property.
> The proposal I made to solve this issue is a static checking at the parse
> time that would reject declarations containing property references whose
> fallback value isn’t recognized by the browser :
> .selector {
>     background: use(my-bg-color);
>     background: use(my-super-cool-bg, unsupported-feature(...));
> }
> The second declaration of the 'background' property will probably be
> discarded by the user agent because it doesn't understand the
> 'unsupported-feature()' function. In this case, the background will use the
> 'my-bg-color' custom property value. The specification covers more complete
> rules for this that handles more complex cases.

Can you elaborate how this would actually work?  Are you trying to use
random features as a hook for triggering the parser to ignore a
property in certain browsers?

Note that this is a pretty limited form of error-detection, as it
doesn't check if the fallback is actually valid where it's placed,
only that all the values in it are recognized as valid.  attr(), for
example, does a more complete checking, verifying that the fallback is
actually valid where it's placed, which it can do because it places
more restrictions on its fallback.  I purposely decided that, since I
can't really do much meaningful syntax checking, it would be best to
just abandon syntax checking entirely.

Received on Thursday, 6 September 2012 18:17:23 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:03 UTC