Closed Bug 353926 Opened 18 years ago Closed 15 years ago

MathML in HTML5

Categories

(Core :: MathML, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: rbs, Assigned: hsivonen)

References

Details

(Whiteboard: [fixed by the HTML5 parser])

Attachments

(3 files, 1 obsolete file)

At the Firefox engineering meeting in Mountain Views (last December 2005), I pleaded that we enable MathML in HTML5 to advance the cause of MathML, which is so far locked in a XHTML/XML world that does not seem to going anywhere in terms of display content as opposed to data (witness the WHATWG effort). Those to whom I spoke included dbaron, hixie and sicking, and they welcomed the suggestion, asking for a broader discussion. Hixie raised the caveat that MathML elements should still remain in the MathML namespace. He e-mailed me a while ago about a discussion on this matter in the WHATWG mailing list, which can be seen here http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2006-June/thread.html. That discussion is however too broad and involves tangential issues such as inventing another syntax, etc. My original take was simply to enable MathML+HTML, in the same vein as we have MathML+XHTML. I have finally been able to code this up (with Hixie's caveat about keeping MathML elemens in the MathML namespace). I will attach the patch I have so far.
Attached file testcase (deleted) —
Attached patch patch - v1 (obsolete) (deleted) — Splinter Review
Summary: How does MathML-in-HTML5 work? We support MathML-in-HTML5 when these two conditions are met: 1. The DOCTYPE of the document says so. If yes, we load MathML entities (TODO) and flag mMayHaveMathML in the sink. 2. And either a) OR b) is met: a) <html> has the MathML namespace as the value of an attribute with a prefix, e.g., <html xmlns:m="http://www.w3.org/1998/Math/MathML">. In this case, we cache the prefix "m" in mMathMLNameSpacePrefix, and we intercept all <m:tag> in the document and create MathML content nodes for them. b) MathML fragments are in the document as <math xmlns="http://www.w3.org/1998/Math/MathML"> ... </math> In this case, we intercept all non-HTML elements inside the <math> tag and create MathML content nodes for them. Issues: 1. Tag soup: we understand that we are exposing ourseleves to this. 2. a) What about CSS matching rules? From the Style System point of view, the document is still HTML, but <m:math> is the MathML namespace. We might have to special case MathML-in-HTML5 in the Style System as well. b) The second option raises an issue with HTML-in-MathML, e.g., <math xmlns="http://www.w3.org/1998/Math/MathML"> <b>bold</b> </math> We don't intercept the <b> in this case. Hence, even though it is HTML-in-MathML without an explicit XHTML namespace for <b>, the HTML sink will give <b> a HTML content node. This is not really XHTML friendly. On the other hand, we don't want to be an XML parser either... These are conflicting objectives. We need to decide what to do. We may agree to only support tags with prefixes as in a), or also keep b) knowing that it has this XHTML unfriendly behavior.
As noted on the newsgroups, I don't think we should do this by having namespace syntax. I think we should just automatically assume that if the HTML parser parses any of the following elements: math, mrow, mfrac, msqrt, mroot, mstyle, merror, mpadded, mphantom, mfenced, menclose, msub, msup, msubsup, munder, mover, munderover, mmultiscripts, mtable, mlabeledtr, mtr, mtd, maction ...that they get put into the DOM with the MathML namespace. (Note that this would be done while not changing the parser -- these elements don't get any special processing other than changing the namespace. i.e. they are parsed just like <xyzzy>.)
I had to update to pick the changes in bug 355451 that conflicted with the earlier patch. Since the prefix approach (included in the current patch) is not going to be retained, I am just dropping this update here for the record.
Attachment #239770 - Attachment is obsolete: true
I believe this is fixed by bug 487949.
QA Contact: ian → mathml
Assignee: rbs → nobody
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by the HTML5 parser]
Target Milestone: --- → mozilla1.9.3a5
Assignee: nobody → hsivonen
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: