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

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.

~TJ

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