Describe how to layout DOM elements violating HTML5 model
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 56
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
cc @bfgeek
This was discussed during the previous meeting.
The HTML parser has some restrictions on the DOM tree but one can always use JS API to insert elements where they want: https://mathml-refresh.github.io/mathml-core/#html-and-svg
Some cases:
-
non-MathML elements used inside MathML elements that only accept MathML children (e.g.
<math><p>x</p></math>. What WebKit and Chromium do is not to create any layout box i.e. don't render anything. Firefox renders something. Note that HTML has very precise definition (e.g. only allowing phrasing element or annotation element with special encoding values) that we probably want to simplify as that's adding complexity w3c/mathml#145 -- I think we can either not render anything (like chromium and webkit do) or define a MathML box for such non-MathML element from its CSS margin box (which as @rwlbuis pointed out is probably more consistent with the idea of trying to render everything). -
text nodes inside MathML elements that don't accept text (e.g.
<math>x</math>). Again, WebKit and Chromium don't create any layout box i.e. don't render anything contrary to Firefox. The HTML and MathML3 spec say they should be rendered as if they were wrapped in a<mtext>, but not sure that's worth it w3c/mathml#145 -- And we can again probably define a MathML box for such non-MathML element from its CSS margin box. -
A MathML element that is an invalid childr of another MathML element e.g.
<math><mfrac><annotation>x</annotation><mn><mtext>1</mtext></mn></math>or<mrow><math></mrow>. The HTML and MathML3 spec say they should be rendered as an merror with appropriate message. This is a bit similar to w3c/mathml-core#136 where we instead decided to render something. I think in general since the box layout is recursive we can just render things as already specified by the spec. Probably some care has to be taken for the edge case of<math>and token elements though. -
MathML elements, other than the
<math>root, inside non-MathML elements. e.g.<p><mn>2</mn></p>. I think we can allow these cases too as we already define a CSS box for the MathML ones.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the HTML and MathML Core rules linked in the issue, then review the four malformed DOM cases and the cited related discussions. The work is complete when the handling and layout behavior for each case has been resolved and described consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100