[whatwg] markup as authored in practice

Lachlan Hunt lachlan.hunt at lachy.id.au
Fri Dec 1 23:19:24 PST 2006

Robert Sayre wrote:
> So, is it poisonous to allow
> <!DOCTYPE html>
> <html lang="en-US">
> <head> <title> Demonstration </title> </head>
> <body>
> <div>
>  <p>hmm</p>
>  <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"
> style="float:right">
>  </svg>
> </div>
> </body>
> </html>
> in HTML5?

Yes, that's extremely harmful.  XML syntax cannot and must not be used 
in HTML documents!

1. It gives the false impression that namespaces actually work in HTML.
2. XML languages, like SVG and MathML, require XML parsing.
3. Well-formedness constraints do not apply in HTML, which would only 
help turn XML into another form of tag soup.  (IE's disastrous XML Data 
Islands and Custom Tags provide sufficient evidence of that.)
4. I doubt that HTML parsing requirements for unknown elements would be 
completely compatible with it.

There have been suggestions to add support for things like MathML and 
SVG natively in HTML, but, if accepted, would not use the XMLNS syntax. 
  However, like HTML elements will exist in the HTML namespace without 
any xmlns syntax, MathML and SVG could exist in their own namespaces too.

The best idea so far for how to make it work is for parsers to 
automatically recognise the tag names and put them into the correct 
namespace.  So, for example, when the parser encounters a <math> element 
(and other MathML elements), it would know that it belongs in the MathML 
namespace, and similarly for SVG.  However, such proposals have so far 
been rejected due to complexity and backwards compatibility issues.

Personally, I would rather see such things left for use in XHTML only, 
since browsers that support them are highly likely to support XHTML as 
well.  Note that current lack of support for XHTML in IE is no excuse 
for wanting to use them in HTML instead, and plugins that already add 
support for SVG, MathML and XForms to IE in text/html are extremely 
harmful, for all the same reasons given above.

> Basically, user-defined tags would be allowable if the 
> boundary between HTML5 and those tags were delineated with a URI in an 
> attribute with the name 'xmlns' (no prefix machinery). This suggestion 
> should not be confused with using an XML parser or XML Namespaces to 
> process HTML5.

If any namespace syntax were ever introduced into HTML, though I think 
that would be a bad idea, it must not use the xmlns attribute.  It would 
only serve to blur the distinction between the HTML and XHTML syntaxes 
and encourage the misconception that HTML can be parsed with XML tools.

The XHTML serialisation exists to make use of XML-only features, like 
xmlns syntax.  People wishing to use such features *must* use XML. 
There has been no reason whatsoever given for wanting to try and use 
unsupported XML-only syntax in HTML, most likely because there is no 
valid reason for it.

Lachlan Hunt

More information about the whatwg mailing list