Last Comment Bug 699758 - The SVG map in IE's "Best Practices for Getting Started with SVG" blog doesn't work
: The SVG map in IE's "Best Practices for Getting Started with SVG" blog doesn'...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
http://ieblog.members.winisp.net/imag...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-04 04:57 PDT by Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13)
Modified: 2012-02-02 02:50 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
reduced testcase (1.30 KB, text/html)
2012-01-31 15:24 PST, Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13)
no flags Details

Description Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2011-11-04 04:57:21 PDT
If you go to:

http://blogs.msdn.com/b/ie/archive/2011/10/27/best-practices-for-getting-started-with-svg.aspx

and scroll down to the "choropleth map", when you click on any of the options other than "Year 1", the map turns black.
Comment 1 Robert Longson 2011-11-04 05:03:50 PDT
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.
Comment 2 Cameron McCormack (:heycam) (away Jun 25 – Jul 10) 2011-11-05 10:55:46 PDT
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.
Comment 3 Cameron McCormack (:heycam) (away Jun 25 – Jul 10) 2011-11-05 11:09:41 PDT
From IRC:

 <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
Comment 4 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-01-31 15:24:10 PST
Created attachment 593235 [details]
reduced testcase
Comment 5 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-01-31 16:24:53 PST
Cameron, it's not really clear to me from comment 4 whether you're saying that we should or shouldn't fix this bug.
Comment 6 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-01-31 16:33:30 PST
So I tracked down the source of the load blocking to the "alternates must have title" line in nsHTMLLinkElement::GetStyleSheetInfo.

https://hg.mozilla.org/mozilla-central/annotate/1410782d557d/content/html/content/src/nsHTMLLinkElement.cpp#l429

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:

http://www.w3.org/TR/html5/semantics.html#the-link-element

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.
Comment 7 Cameron McCormack (:heycam) (away Jun 25 – Jul 10) 2012-01-31 16:40:06 PST
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.
Comment 8 Boris Zbarsky [:bz] (Out June 25-July 6) 2012-01-31 18:05:00 PST
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
  string.

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....
Comment 9 Boris Zbarsky [:bz] (Out June 25-July 6) 2012-01-31 18:06:04 PST
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.
Comment 10 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-02-01 05:56:15 PST
Awesome, thanks! Comment 3 makes much more sense to me now in light of all that.

I've contacted Patrick.
Comment 11 Boris Zbarsky [:bz] (Out June 25-July 6) 2012-02-01 06:31:02 PST
I filed https://bugs.webkit.org/show_bug.cgi?id=77549 on WebKit not doing the xml-stylesheet bits from the CSSOM draft.
Comment 12 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-02-01 07:51:10 PST
Ah, thanks. I was just sitting down to do that having got back from lunch - maybe should have said I was going to...
Comment 13 Jonathan Watt [:jwatt] (Away Jun. 27 - Jul. 13) 2012-02-02 02:50:21 PST
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.

Note You need to log in before you can comment on or make changes to this bug.