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

Re: [cssom] Drop support for alternative stylesheets?

From: Gérard Talbot <www-style@gtalbot.org>
Date: Thu, 29 Aug 2013 16:41:50 -0400
Message-ID: <804a3af3f1bd2e074b2f15adb57663e5.squirrel@ed-sh-cp3.entirelydigital.com>
To: "Simon Pieters" <simonp@opera.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Le Jeu 29 août 2013 10:17, Simon Pieters a écrit :
> In the context of this bug
>     https://www.w3.org/Bugs/Public/show_bug.cgi?id=22479
> it was suggested that it may be time to drop support for alternative
stylesheets in the Web platform.

CSS Object Model (CSSOM)
Editor's Draft 28 August 2013
6.2.3 Extensions to the Document Interface

> In data set 18/06/2013 http://webdevdata.org I see 368 sites out of
> using alternate stylesheets (with <link>), so that's 0.7%.
> For the API, I see 0 instances of selectedStyleSheetSet,
> selectedStylesheetSet or enableStyleSheetsForSet.


Are there any browser which currently and correctly support
a) selectedStyleSheetSet attribute?
b) selectedStylesheetSet attribute?
c) lastStyleSheetSet attribute?
d) preferredStyleSheetSet attribute?
e) styleSheetSets attribute?
f) enableStyleSheetsForSet()?

I ask because I do not know these answers.

> 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
> 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
> document.styleSheets. Toggling .disabled doesn't work. The CSSOM API for
switching stylesheets isn't implemented.


In the final analysis, why should alternate stylesheets be dropped? 
Because it isn't popular? Because it isn't implemented in browsers?
Because it wouldn't be useful, helpful? Because developing alternate
stylesheets involves/requires time, efforts, energy? Because the UI is not

Personally, I would not be able to establish the (advantages versus
inconvenient balance sheet) trade-offs regarding the decision to drop
support for alternative stylesheets in the Web platform.

> 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.

I think it must be said that IE8 had bugs and limitations to alternate
stylesheets and, as such, this didn't help its adoption.

> 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
> <link>).

The only known way to switch alternate stylesheets - at least for Presto
and Webkit - is to toggle disabled attribute of <link> via js.

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

I agree: it's bad for performance.

It is also true that *_many_* sites use and declare 12+ linked
stylesheets, sometimes with hundreds of declarations each, totaling
thousands of declarations, with many resetting and re-resetting ones, with
complex rules, over-qualified selectors, with over-excessive amount of
containers, etc.. Most of the time, these sites declare all of the
stylesheets which would be needed to view any or all of the webpages of
the site... but if you visit only 1 page, then your browser loads all of
the stylesheets, rules, declarations in memory anyway when the page could
be requiring only 10% of all that is declared and loaded. Same thing with
minified advanced javascript librairies (jQuery, mootools, etc).

> If a user wants to switch styles on a site, presumably the user wants
> 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
> page loads.

Selection persistence across page navigation is indeed a very important
issue. Mark "Tarquin" Wilton-Jones website
uses alternate stylesheets, stores the user's selection in a cookie.

> 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

With Google Chrome 29.0.1547.62, I use Style Chooser 1.2
which allows me to select an alternate stylesheet in a page via a menu.

Eg. The KazGarden-Project uses 30 alternate stylesheets

CSS 2.1 Test suite RC6, March 23rd 2011

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Thursday, 29 August 2013 20:42:24 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:31 UTC