Re: [CSS] Extending media queries

From: "Anne van Kesteren" <annevk@opera.com>
> On Tue, 17 Feb 2009 15:29:52 +0100, François REMY 
> <fremycompany_pub@yahoo.fr> wrote:
>> I just read this (draft of) proposition from Webkit about extending the 
>> 'Media Queries' so that it can reflect the implementation of some 
>> (currently proprietary) properties introduced by Webkit 
>> (http://webkit.org/specs/MediaQueriesExtensions.html)
>>
>> [...]
>>
>> What do you think of it?
>
> It seems to me that the WebKit proposal is addressing a few specific 
> issues. Namely hardware for which supporting 3D transforms or even 2D 
> transforms is not feasible, static media which will not do animations or 
> transitions

Yes, it's true. But it's nothing else than a way for the developer to know 
if he
can use theses properties or not. If he can use it, he'll use it, if not, he 
will use
another solutions to display his site. Right ?

> while you are proposing feature sniffing which has been  rejected for 
> several years now and is always propposed as some sort of  technical 
> solution without detailed explanation of why it is needed

For the same reason. Imagine Opera implemented border-image but not
box-shadow. If I want to put a box shadow outside the buttons on my site.

I prefer to use box-shadow. But if the browser doesn't support box-shadow,
then I'm ready to use border-image as fallback (but it will be a bit 
ugglier).

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) { ...}

Without it, I will need to use JScript to find the browser I'm working with 
and,
by knowing which browsers support box-shadow, applying the good class to
the root element to switch mode in CSS. It rely on JScript (which is not 
good),
it cost some time for me to test all browsers, and I don't like it.

:root.boxShadow xxxx { ... }
:root.borderImage xxxx { ... }
<script>...</script>

The use cases are clear, I think.

> how
> it is going to be trusted/useful,

How it's going go be useful, I think it's clear.
How it's going to be trusted, yes, it's difficulter to say. A browser can 
lie on his real
capacities, but it's completely stupid, because it will be relayed on the 
web and it
will make the browser uncompatible with sites relying on the @media 
filtering.

When you ask a browser to implements the 'transform-3d' media, you hope that 
the
browser will not say 'Yes, I support it' when it's false. I hope the same 
thing for my
proposal.

> and what the backwards compatibility  story will be.

I don't understand you here. But this @media will only be a way for the 
developper to
filter a browser he don't know based on his capacities. The developers will 
continue to
test their site on the major browsers, so if a test is not usable because a 
browser return a
false response, then the developer will try to find anoter test. It's 
already how it works now.

When a browser doesn't support a CSS property, we find a way to detect it 
and return a
'special' CSS sheet to this browser to correct the problem.

I hope I've clarified the vision I had when I wrote my mail,
Please feel free to respond me if you think I missed some important point,

Regards,
Fremy 

Received on Tuesday, 17 February 2009 15:57:15 UTC