Re: [CSS] Extending media queries

On Feb 18, 2009, at 7:37 AM, Germain Garand wrote:

> Le mercredi 18 février 2009, Brad Kemper a écrit :
>> On Feb 17, 2009, at 3:57 PM, Germain Garand  
>> <germain@ebooksfrance.org>
>>
>> wrote:
>>> Le mardi 17 février 2009, François REMY a écrit :
>>>> How can I do to know if the browser that read my page support box-
>>>> shadow ?
>>>>
>>>> With my proposal, it's simple :
>>>> @media (implements: box-shadow) { ... }
>>>> @media !(implements: box-shadow) and (implements: border-image)
>>>> { ...}
>>>
>>> Remember that media queries are about describing the output device,
>>> not about
>>> the user agent.
>>
>> The user agent is typically part of the software, but the software is
>> part of the device.
>
> Of course I meant User Agent in the restricted sense of "an  
> implementation of
> CSS" - regardless of the output device, since here the question was  
> clearly
> about the features of the engine. I could have used 'CSS engine' to  
> eliminate
> this ambiguity.
>
> The output device is fully extrinsic, by definition, to the CSS  
> engine, no
> matter if the former is software or hardware.

I don't think the distinction you are making between different chunks  
of the software is all that strong. Why can the width of the UA window  
that the user manipulates be considered a media feature, but not some  
other aspect of the software environment that the UA is aware of? The  
distinction is artificial and arbitrary.

> It is even the point of Media Queries to make CSS somewhat aware of  
> the
> constraints of this extrinsic system.
>
>> Take 'color' for instance. Most monitors support
>> millions of colors these days, but it is the OS control panel (e.g.  
>> on
>> Windows or Mac) that determines if the UA will report millions or  
>> 256.
>
> a CSS engine does not report anything - but I think you got my point  
> now.
>
>> Besides that, features like 'width' are determined almost entirely by
>> the software under user control, and can be greater than the device
>> width.
>>
>>> But anyway, like all User Agent detection schemes, it will be abused
>>> to
>>> provide selective support, undermining CSS's graceful fallback on a
>>> global
>>> scale:
>>>
>>> @agent (implements: -ozm-proprietary-property) { @import ... }
>>> @agent (implements: -bzo-proprietary-property) { @import ... }
>>> /* sorry, you are out of luck, welcome to the wonders of unstyled
>>> content */
>>
>> I'm sorry, but you can do exactly the same sort of thing with media
>> queries as is. For instance, you can have '@media screen and (max-
>> width:700) {...}' and watch as all your styling disapears when the
>> window is stretched to over 700 pixels wide.
>>
>
> that query won't target a specific User Agent.

No, but my point is that it allows the author the power to stupidly  
create styles that leave the page unstyled in many common situations.  
Which seemed to be the point of your comment, "sorry, you are out of  
luck, welcome to the wonders of unstyled content". So you want to  
protect authors from their own idiocy wrt media queries, even though  
we are not doing that for existing media queries. Your argument lacks  
consistency.

> Any user agent supporting Media Queries will behave the same, given  
> the same
> output device.
>
> Whereas testing for CSS features *implementation* would let content  
> writers
> trivially single out some UAs as a whole based e.g. on CSS vendor  
> prefixes,
> as in my example.

I don't know why you think authors would want to go to such lengths to  
ensure that a particular UA had no style. And if they did, so what?  
Any author can make their pages look awful if they really want to.  
Even without the new media queries, I can load a style sheet that only  
loads for print media.

The truth is, this feature, as described by Fremy, would most likely  
be used in small blocks to deal with known cases where one UA or UA  
environment differs, in order to provide an extra rule or two here and  
there in the style sheet. Like this, perhaps:

input.signon {
	background:url(inner-label_userID.png) no-repeat 0 0;
}
@media (supports:input[placeholder]) {
	input.signon { background-image:none; }
}

...or perhaps as an extra style sheet to add to the base style sheet  
in certain situations. Just because implementors still have nightmares  
about the way User Agent Strings were misused a decade ago is no  
reason to deny such an obviously useful feature. It is, at least,  
obvious to almost every author whose ever tried to push the boundaries  
of CSS styling. And even User Agent Strings remain vital to authors,  
including those who design pages and sites for implementors.[1]

> This is very bad.

Only if the UA is trying overly hard to be my nanny.

>
>
> Greetings,
> Germain

[1] http://www.mozilla.com/en-US/firefox/ (detects platform), http://www.me.com 
  (looks for supported browser).

Received on Wednesday, 18 February 2009 17:43:06 UTC