[whatwg] So if media-queries aren't for determining the media to be used what are they for?

Tab Atkins Jr. jackalmage at gmail.com
Tue May 15 15:27:48 PDT 2012


On Tue, May 15, 2012 at 3:06 PM, Chris Heilmann <codepo8 at gmail.com> wrote:
> I also wonder what we do with videos? Surely they have the same issues and
> there is no proposal for changing the syntax there. I do not like the syntax
> of this. Yes it is more terse but it smacks of the horrible syntax of
> window.open properties and other comma separated visual attributes.

<video> is a special case, unfortunately.  It would be difficult to
avoid using <source> there, but we shouldn't look at it as a good
example in general.  Using <source> introduces a lot of problems that
would be good to avoid if possible.

> From a semantic point of view this is a terrible mix of everything -
> something that the picture proposal with multiple sources was not.

There's no semantics in here - this is all presentation and usability.
 This is just a very compact way to state the information that
<picture> presented more verbosely.

<img srcset="foo.jpg 600w 2x"> is no more a "terrible mix of everything" than

<picture>
  <source src=foo.jpg media="min-width:600px" resolution=2>
</picture>

is.

> Let's not forget that this is a new use case - one that might get more
> complex with more UA changes in the future. Maybe we have holographic images
> soon with a X Y and Z position. Shoehorning this into the IMG element
> doesn't make much sense to me.

We should take care not to be future-hostile, but designing for all
hypothetical futures just results in muddled, hard-to-use designs.
Among current MQs, there are 2/4 (depending on if you count min/max
separate) queries you definitely want to use, and one that *might* be
useful (and which can be added to the microsyntax cleanly).

I'm not aware of proposed future MQs that would be useful to tie into
this functionality, either.


> embed is the fallback to video with various sources. img is the fallback to
> embed. I'd like to see picture - done like video for consistency as it is a
> new use case for images. Old browsers could disregard them and new ones can
> use mediaqueries to apply the different sources as needed. Yes, mediaqueries
> do not all the things we need here and browsers have bugs loading various
> sources instead of only one but these are things to fix in the browser
> engines, not add an extra use case in the spec.

See the blog post I wrote today so I'd have to stop giving this same
argument over and over again. ^_^ <http://www.xanthir.com/blog/b4Hv0>.
 You simply can't make a good decision about which resolution to send
to the user based on information from Media Queries.

~TJ



More information about the whatwg mailing list