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

Ian Hickson [mailto:py8ieh@bath.ac.uk] 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, but not in the manner you suggest.  Your note about this
not being "100% backwards compatible" understates the issue:

>[Note that this is not 100% backwards compatible, since in HTML 4.0
>browsers all the style elements, even those with title attributes,
>will get used, whereas if using this proposal only the first will. I
>suggest that this is a very minor detail since very few documents ever
>include more than one style element anyway, let alone style elements
>with title attributes.]

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.  That's what happens in IE since 4.0, and I
believe Navigator 4.x as well (haven't checked Mozilla).  Preferred LINKed
stylesheets are always applied on load, even if there are multiple TITLE
values among those applied.  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?

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.

As an implementer with a long history with CSS stylesheets, and a large
backwards compatibility issue, I would strongly object to changing this.  If
you want to add the ability to embed alternate (as opposed to preferred)
stylesheets, then I suggest adding some mechanism like a DISABLED attribute
on the STYLE element - which, curiously enough, was in IE 4.0.  :^)  Mostly
as an accident; we put in the object model, and forgot to turn off the
attribute support.

-Chris Wilson

Received on Thursday, 4 November 1999 16:06:06 UTC