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

[cssom] Drop support for alternative stylesheets?

From: Simon Pieters <simonp@opera.com>
Date: Thu, 29 Aug 2013 16:17:37 +0200
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.w2k0nn04idj3kv@simons-macbook-pro.local>
In the context of this bug


it was suggested that it may be time to drop support for alternative  
stylesheets in the Web platform.

In data set 18/06/2013 http://webdevdata.org I see 368 sites out of 53,000  
using alternate stylesheets (with <link>), so that's 0.7%.

For the API, I see 0 instances of selectedStyleSheetSet,  
selectedStylesheetSet or enableStyleSheetsForSet. There might be pages  
that use <link>.disabled to switch, but this seems a bit harder to look  
for. Also the data doesn't include external scripts.

3 sites use <meta http-equiv=Default-Style>, but they don't have  
differently-titled stylesheets. 0 sites use Default-Style HTTP header.  
There could be sites that only include the header if the user has chosen a  
different style sheet set (and the site stores the choice in a cookie),  
but this seems hard to check for.

WebKit and Blink don't load alternative stylesheets and don't put them in  
document.styleSheets. Toggling .disabled doesn't work. The CSSOM API for  
switching stylesheets isn't implemented. The only thing that does seem to  
work is changing Default-Style, but doing so leaves the CSSOM in a weird  
state: the old stylesheet is emptied of its cssRules and the new  
stylesheet still isn't exposed.

Firefox and IE10 have UI for switching stylesheets. Only Firefox support  
the CSSOM APIs for switching stylesheet sets. (Don't know about IE11.)

It would be interesting to have data on how often users switch  
stylesheets, both using the browser's UI and using JS-based switchers  
provided by the page (I think most such switchers just toggle .disabled on  

The API around alternative stylesheets assume that non-preferred  
stylesheets are loaded (and present in document.styleSheets). Doing so is  
bad for performance for users that don't switch stylesheets on pages that  
have alternative stylesheets (or arguably it's bad for all users).

If a user wants to switch styles on a site, presumably the user wants the  
switch to persist across page navigations. This is not the case with  
alternative stylesheets without cooperation of the site -- it needs to  
manually store the choice and manage which style sheet to have enabled on  
page loads.

My proposal right now is, for the sake of discussion, to drop everything  
that has to do with alternative stylesheets (which most closely matches  
what WebKit and Blink do today). Are Mozilla and Microsoft OK with that?

Simon Pieters
Opera Software
Received on Thursday, 29 August 2013 14:11:45 UTC

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