If you go to:
and scroll down to the "choropleth map", when you click on any of the options other than "Year 1", the map turns black.
Just go to http://ieblog.members.winisp.net/images/20111027-blog_map.html
Has these elements...
<link rel="stylesheet" href="20111027-year1.css" />
<link rel="stylesheet alternate" href="20111027-year2.css" />
<link rel="stylesheet alternate" href="20111027-year3.css" />
<link rel="stylesheet alternate" href="20111027-year4.css" />
but document.styleSheets seems only to include the first of these.
If I put title="" attributes on the <link>s, then they all appear in document.styleSheets. Looking at http://dev.w3.org/csswg/cssom/ (which seems to to be the most recent spec defining document.styleSheets), I cannot see anything that should prevent those title-less style sheets going into the collection.
<annevk> probably should not include those
<annevk> I think that might not get past the "create a style sheet" steps
<annevk> or should not, anyway, because it's useless
<heycam> annevk, where is "create a style sheet" actually invoked?
<heycam> annevk, for link elements that is? I can see there's a section for <?xml-ss?> and Link headers...
<annevk> in HTML I think
<annevk> though I'm not sure if Hixie is doing that properly
I filed a bug on HTML to ensure it invokes the correct functionality in CSSOM that should indeed prevent title-less alternate style sheet <link>s from appearing in document.styleSheets: http://www.w3.org/Bugs/Public/show_bug.cgi?id=14703
Created attachment 593235 [details]
Cameron, it's not really clear to me from comment 4 whether you're saying that we should or shouldn't fix this bug.
So I tracked down the source of the load blocking to the "alternates must have title" line in nsHTMLLinkElement::GetStyleSheetInfo.
So I wonder if we can remove that, or if I should try and persuade Patrick to add 'title' attributes to their demo. Unfortunately it seems like webkit doesn't bother to require 'title' attributes either, so I'm not sure how practical it is for us to require them. Also I don't see anything in HTML 5 that says implementations must not use alternate stylesheets if the 'title' attribute is omitted:
If we do want to persuade Patrick to have their demo fixed, then it would help if someone could point me to some relevant spec text saying that's what implementations should do.
Otherwise I'd be happy to provide a patch to get this IE demo working.
I did not check other implementations but CSSOM says that HTTP Link headers that identify alternate style sheets with no title do not get a style sheet object created for them. You are right though that HTML doesn't link to the _create a style sheet_ definition in CSSOM or do the same checks as would be required for HTTP Link headers.
What the HTML5 spec has to say on the matter is the following. First, at http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-stylesheet it says:
If the alternate keyword is also specified on the link element, then the link is an
alternative stylesheet; in this case, the title attribute must be specified on the link
element, with a non-empty value.
This is an authoring conformance requirement, so the markup in comment 1 is not valid HTML5. The reason for this authoring requirement is that there's nothing really sane a UA can do with an "alternate stylesheet" with no title....
As far as UA requirements, the spec at the same URI says:
If the resource is an alternative stylesheet then the user agent may defer obtaining
the resource until it is part of the preferred style sheet set.
This last links to the CSSOM spec, which says at http://dev.w3.org/csswg/cssom/#style-sheet-set :
A style sheet set is an ordered collection of one or more style sheets from the
document style sheets which have an identical style sheet title that is not the empty
which means that alternate stylesheets with no title are never in a style sheet set, and hence a conformant UA is allowed to never load them.
Past that, HTML5 defers to CSSOM in terms of what happens with <link rel="stylesheet"> elements and whether they cause creation of entries in document.styleSheets, since the CSSOM is what defines document.styleSheets. The CSSOM doesn't cover this case at the moment, but the two cases it does cover are xml-stylesheet PIs and Link headers. The former says:
2. If there is an alternate pseudo-attribute whose value is a case-sensitive match for
"yes" and title is the empty string terminate these steps.
(so would not lead to creation of a stylesheet object). The latter says:
2. If one of the (other) link relation types is an ASCII case-insensitive match for
"alternate" and title is the empty string terminate these steps.
Again, no stylesheet object. Per comment 3, the CSSOM editor thinks that HTML <link> elements should also have this behavior. Comment 3 also points out the open spec bug on the HTML spec to make it do so.
So yes, I think the demo needs fixing (and I bet WebKit messes up both of the cases the CSSOM does define; worth testing and filing bugs as needed). Simply citing that the demo is using invalid HTML5 might be a good start....
But if that fails, point out that it relies on a behavior (loading the stylesheets) that the spec does not in fact require from UAs.
Awesome, thanks! Comment 3 makes much more sense to me now in light of all that.
I've contacted Patrick.
I filed https://bugs.webkit.org/show_bug.cgi?id=77549 on WebKit not doing the xml-stylesheet bits from the CSSOM draft.
Ah, thanks. I was just sitting down to do that having got back from lunch - maybe should have said I was going to...
The map on that blog post has been fixed and now works in FF, and the IE guys are going to look at the case for changing how the handle alternate style sheets.