Re: Feature queries

fantasai <fantasai.lists@inkedblade.net> wrote:

> bz asked me to post a proposal on feature queries: syntax for allowing
> authors to apply CSS rules based on whether a particular CSS feature
> is supported.

I'm definitely for this in general, but I have some kibitzes.

> My proposal is two syntaxes. The first is an at-rule, which is handy
> if part of the style sheet depends on a major CSS feature such as
> Tempate Layout.
> 
>    @supports ( declaration-block ) {
>       ruleset
>    }

This needs 'else' and 'else if' constructs.  How about

@if supports( ... ) {
   ruleset
}
@elif supports( ... ) {
   ruleset
}
@else {
   ruleset
}

This also makes it easier to extend the syntax of conditional
expressions later.  We could even subsume @media into it.

> This could potentially support media-query like operators like 'and'
> and 'not'.

Very much wanted, IMO.

> The second is a !important-like syntax: all declarations
> with !supported must be supported for the style rule to take effect.

I'm not sure I understand this.

>    tag {
>      color: white;
>      text-shadow: black 0 0 4px !support;
>    }

If the text-shadow property is not supported, the entire declaration
block is ignored?

How do shorthands behave, if just one of the subcomponents of the value
is not supported?

zw

Received on Wednesday, 9 December 2009 18:06:21 UTC