[webkit-dev] HTML5 Parsing & MathML

Alex Milowski alex at milowski.org
Mon Oct 4 10:03:41 PDT 2010


On Fri, Oct 1, 2010 at 12:52 PM, Adam Barth <abarth at webkit.org> wrote:
> Our parser follows the spec (modulo late-breaking spec changes that we
> haven't picked up yet).  The different namespaces can only be nested
> in certain ways, unlike in XML where arbitrary nesting is possible.

Actually, I don't think a MathML annotation-xml with an SVG child element
is going to work properly in WebKit the way the current code is
setup.  I'll test that.

This is place where I think the parsing rules for HTML5 need to be
adjusted so we get the same results for HTML or SVG embedded
in MathML regardless of HTML or XHTML syntax.  Digging deeper
into what the HTML5 specification says for "foreign content", the
HTML "div" element would generate a parse error:

<p> ...
<math>
<mfenced open='[" close="]">
<div> ... random stuff </div>
</mfenced>
</math>
</p>

It would then pop the open stack back to the parent "p" element
and the "div" element would be a child of the paragraph and not
of the fencing.

In XHTML, assuming there are appropriate uses of
namespaces, everything would work fine and you'd get a "div"
element fenced with stretching square brackets.

So, if you cut-n-pasted the same content with the 'xmlns'
attributes, you'd get two very different results.

That really feels "fixable" but I'm going to need to think a bit
more about what adjustments there would need to be
to the rules.

I wonder what the intersection of local names is between
MathML and HTML ...

This is, of course, an HTML5 issue and not really an WebKit
issue except for the question of difficulty of implementation.

-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics


More information about the webkit-dev mailing list