Re: Browsers downloaded linked files regardless of media type

On 1/26/11 2:40 PM, Antony Kennedy wrote:
> Safari and Firefox (which are the only I've tested so far) both opt to download a file with an unknown or unsupported media type, and then ignore the contents. The spec does not mention at all what the behaviour should be  it only states how the files should be parsed. Regardless of whether the<link>  tag or @import rules are used, the file is still downloaded by the browser.
> 	<link rel="stylesheet" href="test.css" media="boat" />
> 	@import url(test.css) boat;
> Both of these commands will download a file (you can observe this in a proxy, firebug, or the web inspector).
> Any performance gain by serving files only to those devices that can make use of them are bypassed in this instance.
> Is this a browser bug?

The problem is that neither the media of the link nor those of the 
document are fixed.

So Gecko always downloads stylesheets, independent of the media.  Then 
we dynamically enable or disable them based on whether the media match 
the current presentation.

We could special-case media types we know we don't support, but even 
then if your script changes the media then suddenly we have to go 
download the stylesheet... or something.

Furthermore, there is benefit in having document.stylesSheets and other 
CSSOM bits not depend on the media types involved (because the 
alternative is that scripts tested against one medium will throw 
exceptions in another one); the only way to do that is to download the 


Received on Thursday, 27 January 2011 01:34:38 UTC