Re: Alternate stylesheets and the "disabled" DOM property

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

That's how this was originally implemented by browsers. I discussed this with
DOM people from both Netscape and Microsoft a few years ago and both agreed that
this usage of the 'disabled' attribute was not what the 'disabled' attribute
intended to be.

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

That's clearly what we had in mind at the end of our discussion, yes.

 >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

cons: no DOM mechanism to directly select a set based on its name. That's connex
to your item above but deserves to be mentioned independently.

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

I think approach #2 is more logical and in the end offers more control to both
the web author and the user on the document's rendering. I think approach #1 was
just a convenient hack, nobody was using the 'disabled' attribute anyway so why
not for style sets...

</Daniel>

Received on Tuesday, 30 September 2003 05:51:02 UTC