Re: Feature queries

On Sat, Dec 12, 2009 at 8:45 AM, Steven Simpson <ss@comp.lancs.ac.uk> wrote:
> On 09/12/09 18:42, Tab Atkins Jr. wrote:
>> On Wed, Dec 9, 2009 at 1:48 AM, fantasai <fantasai.lists@inkedblade.net> wrote:
>>
> @supports {
>>>  tag {
>>>    background: white;
>>>    color: gray;
>>>  }
>>>
>>>  tag {
>>>    color: white;
>>>    text-shadow: black 0 0 4px !support;
>>>  }
>>>
> }
>
>> This seems like a much worse idea for backward-compat reasons.  Legacy
>> clients that don't understand !support will blithely apply the
>> color:white and just ignore the next line like normal.
>>
>
> Any better if the scope is @-marked explicitly (as shown above)?  The
> whole thing will be skipped if not recognised (right?), and it allows
> other rules that don't contain !support to be dropped.

Yes, that is better.  Best of both worlds, actually; the only
sacrifice is that you're having to throw down a bit more syntax.  You
get things ignored in legacy UAs that don't understand the @supports
rule, and you minimize the chances of authors using this to
browser-detect rather than feature-detect, for the reasons I explained
above.


> @supports could also be expressed as a media query feature then, as
> there's no need to incorporate any extra syntax for testing for support
> of specific values of a property:
>
> @media (supports) {
>  x {
>    display: inline-block !support;
>  }
>
>  /* other stuff, disabled if inline-block is not supported */
> }

Sure.  I'm not sure using @media is the most appropriate thing
semantically, but technically there's nothing wrong with this.
Unknown media types are treated as false, so agents that know about
media types but not about support will ignore it like we want.


> Taking a step further, tag to support referencing from other parts of
> the document:
>
> @media (supports-funkiness) {
>  ...
> }
>
> x {
>  x: y !support-funkiness;
>  x: z !support-stupidity;
> }

I can't quite see how this would be used.  Could you come up with an
example using real draft properties?

~TJ

Received on Sunday, 13 December 2009 04:52:23 UTC