untitled alternate style sheet (<link rel="alternate stylesheet">) is not loaded

VERIFIED WONTFIX

Status

()

Core
CSS Parsing and Computation
VERIFIED WONTFIX
16 years ago
16 years ago

People

(Reporter: Martin Honnen, Assigned: dbaron)

Tracking

({testcase})

Trunk
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: WONTFIX?)

Attachments

(2 attachments)

(Reporter)

Description

16 years ago
When I include a style sheet with
  <link rel="alternate stylesheet"
without a title attribute the style sheet doesn't appear in document.styleSheets
nor does the HTMLLinkElement a sheet property allowing me to script the style
sheet. Thus there is no way to enable that style sheet with script.
I don't see any reason why a style sheet linked in without a title should not be
accessible to script. Indeed it is linked in without a title to not appear in
the user agents style sheet menu but to be solely enabled by script.
(Reporter)

Comment 1

16 years ago
Created attachment 75825 [details]
simple style sheet used for test case
(Reporter)

Comment 2

16 years ago
Created attachment 75827 [details]
test case (outputs some properties which show that style sheet is not accessible with Mozilla, and tries to enable style sheet)

The test case works as intended with IE6, that is it shows
  document.styleSheets.length: 2
and the text is colored green.
With Mozilla
  document.styleSheets.length: 1
and as the style sheet can't be scripted and enabled the text is colored blue.
Note that the test case works with Mozilla if a title attribute is added to the
link element.
Keywords: testcase
Per the HTML spec the bahavior of a sheet which is an alternate and has no title
is completely undefined (an alternate stylesheet _must_ have a title set per that):

  To specify an alternate style sheet, set the rel attribute to "alternate
  stylesheet" and name the style sheet with the title attribute.

In fact, the HTML Content sink code has:

if (-1 != linkTypes.IndexOf(NS_LITERAL_STRING("stylesheet"))) {  
  // is it a stylesheet link?
  if (-1 != linkTypes.IndexOf(NS_LITERAL_STRING("alternate"))) { 
    // if alternate, does it have title?
      if (0 == aTitle.Length()) { // alternates must have title
        return NS_OK; //return without error, for now
      } else {
        isAlternate = PR_TRUE;
      }
    }

So we simple never load the sheet.
Assignee: jst → dbaron
Component: DOM Style → Style System
OS: Windows XP → All
Hardware: PC → All
Summary: untitled alternate style sheet (<link rel="alternate stylesheet">) doesn't appear in document.styleSheets → untitled alternate style sheet (<link rel="alternate stylesheet">) is not loaded
I think our current behaviour is correct. Untitled alternate stylesheets are not
stylesheets per HTML.

I think this is a WONTFIX.
Status: NEW → ASSIGNED
Whiteboard: WONTFIX?
(er. Accidentally marked bug ASSIGNED.)
Status: ASSIGNED → NEW
(Assignee)

Comment 6

16 years ago
I'll agree with Ian here.  It's better not to create a quirky behavior that
other implementations will have to imitate, since we're the first implementation
of the HTML spec's alternate stylesheet rules.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → WONTFIX
VERIFIED pep comments
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.