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

Ian Hickson [mailto:py8ieh@bath.ac.uk] wrote:
>On Thu, 4 Nov 1999, Chris Wilson wrote:
>>> Would it be a valid (if 'progressive') interpretation of the spec
>>> to treat the "title" attribute of the "style" element in much the
>>> same way as the "title" attribute of the "link" element is treated
>>> when used with stylesheets?
>> Yes it is valid.
>Great!
>
>So now we just need to agree on what the spec says about the title
>attribute of the LINK element...

You seem to have cut the second half of my sentence, where I said "...but
not in the manner you suggest."

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

WD-Style lays this out quite nicely, saying
'You can specify several alternative styles, using multiple Link headers,
and then use the REL attribute to determine the default style, e.g. in the
following "compact" is applied by default since it omits the "alternate"
keyword for the REL attribute: '

Since the REL attribute [set to "alternate stylesheet"] is the only thing
that causes stylesheets to not be applied by default, it is clear that
non-"alternate"s should be applied by default.  HTML 4.0, on the other hand,
forces the UA to do the TITLE parsing and grouping merely to determine
whether to apply the sheet or not.

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

<STYLE> would be a default (persistent) sheet.
<STYLE TITLE="foo"> would, in this proposal, be an alternate, but not
preferred, therefore not automatically loaded.

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

LINK uses REL to determine whether a sheet is an alternate or not, and TITLE
to determine whether a sheet is preferred or not.  You're using one Boolean
- the presence of TITLE - where LINK has three states.

>Ah, interesting. Do many of them have "title"s, though?

All of them?  Absolutely not.  Some of them?  Absolutely.

-Chris

Received on Friday, 5 November 1999 15:40:17 UTC