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

Re: Browsers downloaded linked files regardless of media type

From: Antony Kennedy <antony@silversquid.com>
Date: Wed, 26 Jan 2011 19:23:41 -0800
Cc: www-style@w3.org
Message-Id: <7AE6F57E-AAF5-4EBE-8B04-130A7C6093F8@silversquid.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
I understand the races issue. And that it would be exposed. And the "something". :)

Deferring loading of stylesheets would be desirable for, for example, print stylesheets – where the user definitely does not need them on page load. Using JavaScript to defer the CSS until after everything else has loaded, but creates a JS dependency which I wouldn't be keen on.

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.

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.

People *would* use screen/handheld for performance if the browsers knew not to download them if unnecessary! A screen stylesheet is typically going to be larger than the handheld counterpart.

"Necessary" would be upon a query to document.styleSheets or the CSSOM. The implications of this are considerable, so I'm happy for us to discount this suggestion.

On 26 Jan 2011, at 18:29, Boris Zbarsky wrote:

> On 1/26/11 8:59 PM, Antony Kennedy wrote:
>> Dynamic changing of the media is of course possible, but it seems completely appropriate to choose not to download the file until it applies.
> 
> The problem is that downloading is asynchronous.  So this introduces races.
> 
> And again, the stylesheet is exposed to the CSSOM.  Not loading it means either not exposing it or lying about the objects or ... something.
> 
>> In fact, this would make it very easy to defer loading of stylesheets
> 
> Why would this be desirable?
> 
>> Should there not be a way to avoid this unnecessary download and the performance hit it implies?
> 
> Perhaps.  Would you trust authors not to misuse it?
> 
> I could live with an opt-in "don't load this sheet if you don't support its medium" attribute.  It would need some careful defining in the face of media queries...
> 
>> Why write a screen stylesheet and a handheld one for performance
> 
> I don't know.  Do people do that "for performance"?  Last I checked this was mostly done because the form factor is very different....
> 
>> Perhaps only download files as necessary
> 
> Define "necessary"?
> 
> -Boris
> 
Received on Thursday, 27 January 2011 03:25:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:36 GMT