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

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 Thursday, 17 May 2012 16:24:53 UTC