W3C home > Mailing lists > Public > www-style@w3.org > December 2009

Re: Feature queries

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sat, 12 Dec 2009 22:51:22 -0600
Message-ID: <dd0fbad0912122051rd080c0fs2c89d615369ff8de@mail.gmail.com>
To: Steven Simpson <ss@comp.lancs.ac.uk>
Cc: www-style <www-style@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:47:12 GMT