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

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

From: Aaron Gustafson <aaron@easy-designs.net>
Date: Thu, 17 May 2012 08:01:59 -0700
Message-ID: <CALWPYzGjUzHb6Fa=OY6q8fAe3yzdeFWEaapqoJn+xXh1vxMHRg@mail.gmail.com>
To: Kornel Lesiński <kornel@geekhood.net>
Cc: public-respimg@w3.org, Matthew Wilcox <mail@matthewwilcox.com>
On Thu, May 17, 2012 at 7:47 AM, Kornel Lesiński <kornel@geekhood.net> wrote:
> On Thu, 17 May 2012 15:22:04 +0100, Aaron Gustafson <aaron@easy-designs.net>
> wrote:
>> Traditionally, the first to match is the one picked. In the video
>> element, this is why we put WebM before Ogg: the same browsers support
>> both, but WebM is smaller, so we put it first so it is the one that’s
>> downloaded.
> Is that the case for <picture> as well? It doesn't seem to match examples.
> How is interpreted source without media? (media="all"? media="none"?)
> http://www.w3.org/community/respimg/2012/03/07/14/
> <picture alt="Alt tag should accurately describe the image represented by
> all sources, though cropping and zooming may differ.">
>  <source src="mobile.jpg" /> <!-- Matches by default. -->
>  <source src="high-res.jpg" media="min-width: 800px" /> <!-- Overrides the
> previous source over 800px before any assets are fetched, resulting in a
> single request. -->
>  <img src="mobile.jpg" /> <!-- Fallback content, in the event the <picture>
> tag is completely unsupported by the user’s browser. -->
> </picture>
> In that case I'd expect <source src="mobile.jpg"> to always match and
> <source src="high-res.jpg"> be impossible to use.

You are correct that it doesn’t match up with the examples. This is
one thing that will have to worked through from an implementor’s
perspective. We need hard and fast rules for precedence. The model
picture is now using seems more like the cascade of style sheets than
the way video and audio sources are handled.

In terms of the source element, media queries are evaluated after the
media type in the process (see "resource selection algorithm":
step 6’s else flow #6) and failure to apply a given source (based on
media query or otherwise) results in a move to the next source.
Picture would need to function the same way lest we cause confusion
for either element type.



Aaron Gustafson
Easy Designs, LLC
+1 877 EASY 313 x101

=== OUT NOW ===
Adaptive Web Design: Crafting Rich Experiences with Progressive Enhancement
Received on Thursday, 17 May 2012 15:02:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:12:38 UTC