W3C home > Mailing lists > Public > www-style@w3.org > September 2003

Alternate stylesheets and the "disabled" DOM property

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 27 Sep 2003 00:08:56 -0400
Message-Id: <200309270408.h8R48urt008163@no-knife.mit.edu>
To: www-style@w3.org

I'm sort of wondering about the proper interaction of alternate style set
selectors such as some browsers have and the "disabled" property of stylesheet
objects in the DOM.  There seem to be two main schools of thought on the
subject:

1)  Changing style sets via the browser UI should set all the sheets not in the
    new set to disabled=true and set the sheets in the new set to
    disabled=false.  Thus the only thing (other than media) that determines
    whether a sheet is currently applied is its "disabled" property.  Scripts
    on the page can arbitrarily "mix-and-match" which stylesheets are enabled,
    hence applied.

2)  The two mechanisms are orthogonal.  When a style set (a title string,
    basically) is selected in the browser UI, all sheets in that style set
    which have disabled=false are applied to the document.  Sheets can be in
    the currently active style set but disabled, and they will not be applied.
    There is no way for script on a page to mix sheets from two style sets
    without changing some title attributes (since the title property of the
    StyleSheet interface in DOM2 Style Sheets is readonly).

For approach #1 the pros are:

1)  DOM completely describes which sheets are applied in a simple way.
2)  Consistent with current implementations (eg Mozilla's) (more on this
    below).

The cons are:

1)  Hard to logically group sheets into sets but temporarily disable some sheets
    in a set.

Any more pros or cons?  I know I've heard others, but I can't recall them

For approach #2, the pros and cons are just the opposite of those for approach
#1.  In particular, this approach does not work like most current browser style
switchers.  This means that if you visit a page that sets sheets disabled and
enabled to emulate alternate set switching (especially for IE), you may end up
with the page disabling all the sheets in the current set, enabling sheets in a
different set, and nothing being applied (since the two mechanisms are
orthogonal).  This can be ameliorated by the introduction of an easy API to
switch style sets.

At the moment, not many pages use alternate sheets at all, and even fewer have
JS switchers, so it still seems possible to standardize on approach #2 if
desired.

So what I'd like to see are some detailed arguments by proponents of those two
viewpoints as to why it should work one way or the other, followed, hopefully,
by browser implementors who support style switchers standardizing on one method
or the other.

I have to admit that this is not completely an academic question, since I'm
considering implementing an API for switching style sets, such as I mention
above, in Mozilla, and I'd sort of prefer not to have to change its semantics
later if/when this gets specified....
    
Thanks for your time,
Boris
-- 
    "What the hell are you getting so upset about?  I
thought you didn't believe in God."
    "I don't," she sobbed, bursting violently into
tears, "but the God I don't believe in is a good God, a
just God, a merciful God.  He's not the mean and stupid
God you make Him out to be."

                     --Joseph Heller, "Catch-22"
Received on Saturday, 27 September 2003 00:08:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:23 GMT