W3C home > Mailing lists > Public > www-html@w3.org > November 1999

Re: The "title" attribute of "style" elements

From: Peter S. Linss <peter@linss.com>
Date: Thu, 11 Nov 1999 12:58:36 -0800
Message-ID: <382B2DFC.EC380CF7@linss.com>
To: Ian Hickson <py8ieh=mozilla@bath.ac.uk>
CC: Chris Wilson <cwilso@microsoft.com>, www-html@w3.org, www-html-editor@w3.org, Dave Raggett <dsr@w3.org>, lehors@w3.org, ij@w3.org, "'L. David Baron'" <dbaron@fas.harvard.edu>
For the record, the Mozilla browser implements this exactly as Ian describes
(<style> element is equivalent to <link rel="stylesheet"> with or without title
attribute). This however, is a seperate issue from how title's get interpreted
by IE.

If you ever apply two stylesheets that have different titles (as IE does in the
initial display), then you get into trouble as soon as you allow the user to
switch to an alternate stylesheet. Since the selection of alternate stylesheets
always groups them by title, you can never return to the initial state.

Consider this example:
<link rel="stylesheet" title="one" href="one.css">
<link rel="stylesheet" title="two" href="two.css">
<link rel="alternate stylesheet" title="two" href="three.css">

My understanding of this is that IE will use both "one.css" (which we all agree
is the preferred sheet) and "two.css" for the initial display, but not
"three.css" (which we all agree is an alternate sheet).

Now say the user gets an alternate stylesheet UI which lets them select between
"one" and "two" (which are the choices dictated by the titles). The user
selects the alternate stylesheet _set_ "two". We all agree this is supposed to
turn off the preferred sheet "one.css" and turn on the alternate sheet
"three.css". But what about the sheet "two.css"? Does IE treat this as a part
of the prefered sheet set and turn it off too? Shouldn't it get selected along
with any alternate sheet that has the title of "two"? What happens when the
user then selects "one"? Does "two.css" get used or not?

Mozilla would see "one.css" as the preferred sheet, "two.css" and "three.css"
as alternates wich only get used when the user selects "two". (unless of course
you complicate this further by adding a "Default-Style" HTTP header (or
meta-equiv) setting the initial stylesheet selection to "two", Ian's import
tests really drive this lesson home...)


Ian Hickson wrote:

> On Fri, 5 Nov 1999, Chris Wilson wrote:
> >>> In fact, the HTML 4.0 spec does not explicitly state that multiple
> >>> LINKed preferred stylesheets (that is, REL="stylesheet" and a
> >>> given TITLE) are not all to be applied on load.
> >> Section 14.3.1 of HTML4:
> >># User agents MUST NOT apply alternate style sheets with a different
> >># style name.
> >>   -- http://www.w3.org/TR/REC-html40/present/styles.html#h-14.3.1:
> > Indeed; you've pointed out the major incompatibility between the
> > HTML 4.0 specification and the "HTML and Style Sheets" draft
> > (http://www.w3.org/TR/WD-style-970324) that was the only
> > specification for HTML and style sheets until December 1997.
> "It is inappropriate to use W3C Working Drafts as reference material
> or to cite them as other than "work in progress"."
> >>> Only by setting the RELationship to "alternate stylesheet" can you
> >>> keep the stylesheet from being automatically applied. A STYLE
> >>> element functions like a LINK with a REL of "stylesheet", not one of
> >>> "alternate stylesheet". Otherwise, how would you make a preferred
> >>> embedded stylesheet?
> >>
> >>Section 14.3.2 of HTML4:
> >>#    * Specify that the style sheet is persistent, preferred, or
> >>#      alternate:
> >>#         + To make a style sheet persistent, set the rel attribute to
> >>#           "stylesheet" and don't set the title attribute.
> >>#         + To make a style sheet preferred, set the rel attribute to
> >>#           "stylesheet" and name the style sheet with the title
> >>#           attribute.
> >>#         + To specify an alternate style sheet, set the rel attribute to
> >>#           "alternate stylesheet" and name the style sheet with the
> >>#           title attribute.
> >
> > Read what I said - how would you make a PREFERRED EMBEDDED (that
> > means a <STYLE> element) style sheet.
> Just give it a title. ("name the style sheet with the title
> attribute") The real question is how to make the style element an
> alternate stylesheet, and not a preferred one. The answer is, include
> it after any other link or style elements with titles (since it has no
> 'rel' attribute).
> > <STYLE> would be a default (persistent) sheet.
> > <STYLE TITLE="foo"> would, in this proposal, be an alternate, but
> > not preferred, therefore not automatically loaded.
> No, it would be preferred if it came before any other preferred
> stylesheets. Just like a <LINK> stylesheet with a TITLE attribute but
> no "alternate" in the REL attribute.
> >> If we indeed assume that the <style> element is like a <link> with
> >> a REL of "stylesheet", then from the above rules the behaviour I
> >> described is exactly what should happen!
> > That's true; however, that wouldn't be your original proposal, would
> > it?
> If, so, my apologies. I intended to propose behaviour whereby the
> 'title' attribute of STYLE elements is treated _identically_ to the
> 'title' attribute of LINK elements, and that all STYLE elements are
> assumed to be "rel=stylesheet".
> > You would not be specifying multiple alternate style sheets, you
> > would be specifying multiple preferred style sheets - and you'd have
> > no way of including a SINGLE alternate style sheet that was not
> > automatically loaded.
> A preferred stylesheet with a different name than a
> previously-specified preferred stylesheet should be treated as an
> alternate stylesheet per the HTML4 specification. I am not proposing
> any change to this part of the specs.
> --
> Ian Hickson
> "So far, people have shown a reasonable amount of sense in evaluating
> souls (whether they are properly priced)."
>   -- Nick Gibbins; Author of http://totl.net/Soul/, 1999-10-05

Received on Thursday, 11 November 1999 15:59:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:51 UTC