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

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


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


> That's what happens in IE since 4.0 [...] Preferred LINKed
> stylesheets are always applied on load, even if there are multiple
> TITLE values among those applied.

That is incorrect behaviour, and has been tested by the ImportTest
since before IE5 was released:

   http://www.bath.ac.uk/%7Epy8ieh/internet/importtest/main/preferred.html


> 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.
#   [...]
#   If two or more LINK elements specify a preferred style sheet, the
#   first one takes precedence.
   -- http://www.w3.org/TR/REC-html40/present/styles.html#h-14.3.2

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!

 
> In addition, as someone who spends a large percentage of his time
> digging through other people's HTML and stylesheets investigating
> bugs, I guarantee you there are a VERY large number of documents
> that include more than one STYLE element.

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

-- 
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, 4 November 1999 17:16:30 UTC