W3C home > Mailing lists > Public > public-respimg@w3.org > May 2012

Re: Is algorithm for selecting based on media query defined?

From: Scott Jehl <scott@scottjehl.com>
Date: Thu, 17 May 2012 22:19:10 +0545
Cc: public-respimg@w3.org, Aaron Gustafson <aaron@easy-designs.net>, Matthew Wilcox <mail@matthewwilcox.com>
Message-Id: <C126D3CA-BE6E-4814-94DF-04161700F85B@scottjehl.com>
To: Kornel Lesiński <kornel@geekhood.net>
I may be misunderstanding your point, but I think the fallback img is there to support browsers that do not natively support/understand picture. 

It's like <canvas> fallback content, ignored if the picture element itself is supported.

There should be a natural fallback for the element without having to resort to a JavaScript polyfill. While I agree that <source media=all> is equivalent to the fallback in a picture-supporting browser, it means nothing to an existing browser today. 




On May 17, 2012, at 10:09 PM, Kornel Lesiński wrote:

> On Thu, 17 May 2012 17:11:18 +0100, Scott Jehl <scott@scottjehl.com> wrote:
> 
>> Well, there are more points of departure here from video than just that. For example, video and audio sources are not reassessed on resize/orientationchange, or at least, as far as I know (I can check).
>> 
>> If the first source is kept, that'd mean ordering images largest to smallest. That seems unnatural/unexpected to me, but I'm not sure if others agree. Maybe it's my mobile-first mentality seeping in :)
> 
> Even if <video><source media> was dropped, selection based on <source type> is 'first to match' as well.
> Moreover I'd like to suggest evaluating fallback <img> as <source media="all"> (to reduce verbosity), and that makes sense when <img> is last (fallback, not fallfront ;)
> 
> 
> The CSS cascade has much more going on, i.e. there's concept of specificity in there as well. I'm wondering whether authors won't think of MQs as selectors and expect specificity to apply as well, which could lead to mistakes:
> 
> <source media="all">
> <source media="screen (min-width:300px)">
> <source media="all">
> 
> No matter what the order of matching, the min-width one won't ever match, but one could assume that it should if it was analogous to:
> 
> * {}
> #min-width {}
> * {}
> 
> 
> -- 
> regards, Kornel Lesiński
Received on Saturday, 19 May 2012 05:41:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 19 May 2012 05:41:26 GMT