W3C home > Mailing lists > Public > www-style@w3.org > September 2013

Re: Media Query Variables

From: Kornel Lesiński <kornel@geekhood.net>
Date: Fri, 13 Sep 2013 11:55:53 +0100
To: Simon Pieters <simonp@opera.com>
CC: "www-style" <www-style@w3.org>
Message-ID: <14116f643e0.2787.7ba2dab7ab189bf60d5422e61747bcec@geekhood.net>
On 13 September 2013 11:18:24 "Simon Pieters" <simonp@opera.com> wrote:
> On Fri, 13 Sep 2013 11:08:21 +0200, Kornel Lesiński <kornel@geekhood.net> 
> wrote:
>
> > That case is suboptimal from performance perspective, since the last 
> variant may be unnecessarily preloaded, but this wouldn't break the page.
>
> The performance problem is my concern.

I think it's important that it can be used in preload scanner, but if 
possible I'd rather not compromise a solution because there may be 
suboptimal cases.
For example preload scanner is irrelevant for JS applications, but 
responsive images and ease of maintenance is important.

> This doesn't solve the problem. We should not add an ability to browsers 
> that we don't want people to use. The only way to make people not use 
> something is to not support it.

The alternative may be having no solution that authors want to use and 
they'll use hacks for responsive images that kill preload scanner in all 
cases, not just when used against best practice.

> We could have the at-rule but only support it in <style>, but that gives 
> the expectation that it also works in external stylesheets. Maybe that's a 
> good thing if we want to allow it in <style scoped> (and have it scoped).

If this rule triggers syntax error in external stylesheets I think it would 
be acceptable compromise, but it's not pretty :/

> > 2. Browsers can postpone loading of the image when preload scanner 
> encounters an unknown variable.
>
> Making the image load block on external stylesheets is not acceptable. I 
> think we should design a solution that enables the browser to download the 
> correct resource as soon as it sees it without blocking on another resource.

This solution enables non-blocking loading. It just doesn't force it.

>
> > The worst case of misuse is bandwidth waste. The right image will be 
> displayed regardless - picture is not like video where you have to make the 
> choice once and do it perfectly first time. It allows browsers to 
> reevaluate options when conditions change.
>
> I think it is important to make the right choice for images on page load.

I agree that's need in most cases, but due to technical constraints this is 
in conflict with another strong case of separation of layout and markup.

I don't mind giving authors choice of losing preload scanner if they prefer 
all media queries to be in stylesheets.

They do have an option of inlining for performance. Technically even 
automatic optimizers like mod_pagespeed could do it for them.


> Do you want this proposal to have no effect for <video><source media>? How 
> about <link rel=stylesheet media>?

That's a very good question. I suppose it should work like media queries 
work currently - affect <link> dynamically and <video> at time of selection 
(or not at all if you prefer).

It would cause race condition for video if browser isn't deferring decision 
until CSS is loaded. OTOH I thought <video media> is being dropped/at-risk 
due to lack of usage and adaptive streaming works better for it than media 
queries, so it may never be a problem in practice.

-- 
regards, Kornel
Received on Friday, 13 September 2013 10:56:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:34 UTC