It’s just data

SVG and MathML Annexes to HTML5

As Anne previewed, HTML5 has recently added support for data attributes and MathML and SVG vocabularies.

The former feels OPMLish to me.  I predict it won’t be long before we see escaped HTML inside data attributes “in order to validate”.  And the RDF/A proponents will (correctly) point out that this isn’t enough information to reliably identify subjects, predicates, and objects.

The latter is of more interest to me.  It isn’t full distributed extensibility, nor is it entirely consistent with the direction that IE8 says they are going, but it is substantial progress.

By my read of the document, a typical standalone SVG document would be rendered correctly if served as text/html to a browser that supports this specification.  Of which, there are none, but more on that in a minute.  An HTML5 parser would insert implicit <html> and <body> elements, would ignore the XML prolog (but likely would sniff the page correctly).  <metadata> would be placed in the wrong namespace, and likely would not validate, but would not cause any rendering issues.  There may be some edge cases with CSS and attribute-value normalization rules and characters like form feeds, but these are likely to be minor.  I’m not clear at all yet on how <scripts> would be handled and if there would be any differences.  I suspect there will be.  Update: Anne assures me that this is not a concern.

As near as I can tell, my weblog would be considered valid HTML5 if served as text/html, with one exception: xml:lang.  But again, none of the current browsers would render the SVG content.  On one hand that’s entirely understandable as it has only been a few dozen hours since the spec updates were made.  But it is troublesome in that these requirements seem entirely author driven and no browser vendors have been very active in the discussion (to be fair, it is clear that Anne has been monitoring the discussion).

I do think an implementation or two at this point would be very helpful.  There’s enough documents to throw at such a prototype that we could quickly shake out any spec or implementation bugs.


FWIW, script element parsing is still the same. You can use <![CDATA[, ]]> inside it (as anywhere else in the foreign lands). I’m not entirely sure this is a good idea as it introduces yet another internal inconsistency for text/html, but it’s probably better for existing tool output.

Posted by Anne van Kesteren at

Even if the parsing is the same, is the object model presented to such scripts the same?  I honestly don’t know.

Posted by Sam Ruby at

Possible use case? I took a valid XHTML+SVG+MathMl page, replaced the head with an HTML5 head using the ISO-8859-1 encoding our Apache sends with text/html, and used the .html extension. For the first SVG on that page, I deleted the namespaces, the second SVG keeps the SVG namespace declaration. The result degraded to the text in the SVG in both FireFox 3 Beta 5 and in Opera 9.5 beta. To my surprise, Amaya 10, displayed both SVG images. Can SVG be dropped into text/html and rendered? I guess the Amaya answer is yes. I would note that the page is not exactly “tag soup” as the code was valid using validator.nu.

Posted by Dana Lee Ling at

Sam, yes. They share the same global object. (More or less identical to doing XHTML+SVG.)

Posted by Anne van Kesteren at

Dinosaur

MathML and SVG come to HTML5....

Excerpt from Musings at

SVG in HTML5 all gone now.

I feel I should break out the crayons.

Posted by Shelley at

SVG will be back.

And xml:lang will be sorted out in due course. Not sure how to fix it yet, but we’ll figure something out.

Posted by Ian Hickson at

Add your comment