Re: Some notes on SVG parsing in HTML 5

On Thu, 26 Feb 2009 03:03:49 +0100, Cameron McCormack <cam@mcc.id.au> wrote:

>> No, <html> is optional, but lack of a doctype is a parse error.
>
> Ah, OK.  So that means the following document would be conforming:
>
>   <!DOCTYPE html>
>   <title></title>
>   <svg xmlns='http://www.w3.org/2000/svg'>
>     <circle r='100'/>
>   </svg>
>
> ?

Yes.


BTW, I missed this part in my first email:

> Any element names that aren't recognised as SVG or HTML ones will be created as plain Element objects (I think).

No, the HTML parser always emits elements in the HTML, SVG or MathML namespace. If you're in SVG context, unknown elements will be SVG elements. (You'll note that the parser never compares against e.g. 'span' or 'g' so "unknown" elements will be treated the same as those under the relevant "Anything else" sections.)

So in

   <svg> <g> <foobar>

"foobar" is an SVG element, and in

   <svg> <desc> <foobar>

"foobar" is an HTML element.

-- 
Simon Pieters
Opera Software

Received on Thursday, 26 February 2009 08:32:21 UTC