W3C home > Mailing lists > Public > public-html@w3.org > March 2009

SVG as Root (was: SVG Feedback on HTML5 SVG Proposal)

From: Doug Schepers <schepers@w3.org>
Date: Tue, 10 Mar 2009 20:58:15 -0400
Message-ID: <49B70CA7.2020800@w3.org>
To: public-html@w3.org
CC: www-svg <www-svg@w3.org>
Hi, Ian-

Ian Hickson wrote (on 3/10/09 7:48 PM):
> On Tue, 10 Mar 2009, Doug Schepers wrote:
>>  * For the case where an SVG file is inadvertently served as 'text/html',
>>  the SVG WG proposes that if the parser encounters an 'svg' element in
>>  the "before html" parse mode that no 'html' and 'body' element be
>>  inserted above the 'svg' element.
...
>
> Why would we want to support SVG files sent as text/html? Surely this is
> an error and should not be supported.
>
> There are a number of practical reasons for which I think this change
> would be unwise:
>
>   * I am concerned also that actually implementing this would consist of a
>     significant change to the parsing algorithm, reaching across multiple
>     insertion modes, affecting very sensitive things like quirks mode
>     detection.
>
>   * It would introduce inordinate complexity in the case of an<svg>  tag at
>     the start of an HTML file, since the DOM would have to be fixed up to
>     have an<html>  root node, which would involve serious surgery to the
>     resulting DOM.
>
>   * The HTML parser is written with the assumption of an<html>  root node
>     throughout, and changing that assumption would be a lot of work both
>     for the spec and all the existing implementations.
>
> I am also concerned that this would lead to very strange behavior for
> authors once they started relying on it. Consider for instance the
> difference between this:
>
>     [BOM]<svg>...
>
> ...and:
>
>     [BOM][BOM]<svg>...
>
> ...where "[BOM]" represents a Unicode byte-order mark. These two files,
> indistinguishable in most text editors, would have different root
> elements. The de-facto HTML parser today goes to some lengths to avoid
> problems with things like this (e.g. propagating attributes from stray
> <html>  and<body>  tags).

Personally, I agree with you here.  But I don't have any grand 
suggestion for fixing the case where SVG is served with the wrong MIME 
Type, or where authors got lazy or made some other mistake.  Does your 
current proposal deal with this, and if so, how?

If by "this is an error and should not be supported" you mean that the 
file simply wouldn't render anything... hmmm, ugly, but I might agree 
with that.

Regards-
-Doug Schepers
W3C Team Contact, SVG and WebApps WGs
Received on Wednesday, 11 March 2009 00:58:26 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:02 UTC