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

Re: Browsers downloaded linked files regardless of media type

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 26 Jan 2011 22:31:56 -0500
Message-ID: <4D40E72C.4060508@mit.edu>
To: Antony Kennedy <antony@silversquid.com>
CC: www-style@w3.org
On 1/26/11 10:23 PM, Antony Kennedy wrote:
> Deferring loading of stylesheets would be desirable for, for example, print stylesheets – where the user definitely does not need them on page load.

See, that's a good example of where deferring is NOT a good idea.  It 
seems like one at first, from a web developer perspective, but think 
about it from a user perspective.

Say I load a page.  Then I want to print it.  I want my browser to 
print, not start contacting servers and downloading stylesheets.  I 
especially don't want this to happen if I am no longer connected to a 

> Using JavaScript to defer the CSS until after everything else has loaded

The _prioritization_ of the loads is a separate issue entirely.  But 
note that last I checked the HTML5 spec in fact requires that such 
sheets be loaded, independent of media, before any scripts that come 
after the sheet can run...  Perhaps that needs to be changed.

> How about something like:
> <link rel="stylesheet" href="test.css" media="boat" autoload="false" />
> and:
> @import url(test.css) boat autoload-false;
> …and defaulting to true in both cases? Or something similar.

Right, that's what I said I could live with.

> In these cases, the author would have to understand that these stylesheets would not be exposed to the CSSOM or document.styleSheets. I'm unclear on how authors could misuse this.

Oh, easily.  Set it (e.g. by copy-paste from somewhere else), and don't 
test in a browser that actually supports the attribute.  Authors do that 
sort of thing all the time.

> "Necessary" would be upon a query to document.styleSheets or the CSSOM

If that happens, it's too late.  You can't hit the network and load a 
stylesheet at that point.  Your only options are to have the data, fake 
it, or throw an exception.

Received on Thursday, 27 January 2011 03:32:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:55 UTC