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

Re: Media Queries and optimizing what data gets transferred

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 25 Jan 2013 09:50:19 -0800
Message-ID: <CAAWBYDDJJgSqRX7v6VJ4AWcjPpwTVVgh=TLeLB6PU=ZKXPTJsA@mail.gmail.com>
To: Henri Sivonen <hsivonen@iki.fi>
Cc: www-style list <www-style@w3.org>, Ilya Grigorik <ilya@igvita.com>
On Fri, Jan 25, 2013 at 4:20 AM, Henri Sivonen <hsivonen@iki.fi> wrote:
> Thus I propose that Media Queries gain a way to be flagged as
> evaluated only at page load time such that the browser promises to the
> Web author that it won't eagerly download data that's not applicable
> in the state the browser is in during the page load.

I've heard several suggestions that we allow a stylesheet to be marked
as "non-essential", so it doesn't block script loads or the document's
load event.  Usually the suggestion is in the form of adding an
"async" or "defer" attribute to <link> (I never learned which did what
in <script>, so choose whichever seems closer to the desired intent).

Perhaps we could hook your desired functionality into this as well?
Async stylesheets don't load at all *until* their media query
evaluates to true, and they never block other loads.  The default MQ
is just "all", so "async" by itself will just shift the stylesheet
down in load order, but if you apply a non-trivial MQ, it'll avoid
loading entirely until it's ready.

~TJ
Received on Friday, 25 January 2013 17:51:07 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:04 GMT