[whatwg] Parsing MathML in HTML5

Simon Pieters zcorpan at hotmail.com
Mon Oct 9 13:14:54 PDT 2006


Hi,

I have noticed that there have been some discussion about MathML in HTML5 on 
some lists and newsgroups, but I'm not subscribed to those (yet).

If I understand it correctly Ian's proposal is to have a list of elements 
that are put in the MathML namespace when parsing. I have a slightly 
different proposal which I'll describe below:

Instead of having a list of elements that are put in the MathML namespace, 
<math> is a sort of namespace- and parsing scoping element so that it and 
all of its descendants are in the MathML namespace, and also that all tags 
inside <math> are parsed as any other <xyz> tags except for start tags for 
empty MathML elements. E.g., <none> inside <math> is an empty element but 
outside it is not; <br> is not an empty element inside <math>.

For setting .innerHTML on MathML elements, "root" would be a new <math> 
instead of a new <html>.

This way existing tags on the web that happen to be the same as MathML tags 
(outside <math>) won't be affected; there's no need to profile MathML to 
HTML; MathML3 can introduce new elements (even with the same names as HTML 
tags if they wanted to) without any need to change the parser (unless they 
introduce new empty elements).

For example, with my proposal this (invalid) text/html document:

   <!doctype html>
   <title>test</title>
   <p>This is not MathML: <mi>x</mi></p>
   <p>The following is MathML:</p>
   <math>
    <mi>x</mi><mo>+</mo><mn>2</mn>
    <p>This is still MathML and <br> is not an empty element</p>
   </math>

...would be equivalent to this XML document:

   <html xmlns="http://www.w3.org/1999/xhtml"><head><title>test</title>
   </head><body><p>This is not MathML: <mi>x</mi></p>
   <p>The following is MathML:</p>
   <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mi>x</mi><mo>+</mo><mn>2</mn>
    <p>This is still MathML and <br> is not an empty element</br></p>
   </math></body></html>

Please cc any other lists as appropriate.

Regards,
Simon Pieters





More information about the whatwg mailing list