[webkit-dev] HTML5 Parsing & MathML

Adam Barth abarth at webkit.org
Mon Oct 4 11:40:51 PDT 2010


On Mon, Oct 4, 2010 at 10:03 AM, Alex Milowski <alex at milowski.org> wrote:
> 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.

If you have feedback on the HTML5 working group, it's probably a good
idea to convey that to the working group sooner rather than later.
The HTML5 specification is close to Last Call, after which it will be
more difficult to make changes.

Adam


More information about the webkit-dev mailing list