Skip to content

Clarify MathML integration points #101

Closed

Description

@fred-wang

The MathML Core spec defines the following integration points:
https://mathml-refresh.github.io/mathml-core/#othertech

In particular, it relies on the validator schema:
https://github.com/validator/validator/blob/master/schema/.drivers/html5-svg-mathml.rnc#L9
https://github.com/validator/validator/blob/master/schema/.drivers/html5-svg-mathml.rnc#L11
https://github.com/validator/validator/blob/master/schema/.drivers/html5-svg-mathml.rnc#L18
https://github.com/validator/validator/blob/master/schema/.drivers/html5-svg-mathml.rnc#L29

By default MathML4's RelaxNG schema does not allow foreign content in token elements. However, there are suggestions to allow it in Chapter 6:
https://mathml-refresh.github.io/mathml/chapter6.html#world-int-combine-other

Finally, the WHATWG HTML5 spec describes integration points for mi, mo, mn, ms, and mtext, annotation-xml and foreignObject:
https://html.spec.whatwg.org/#mathml
https://html.spec.whatwg.org/#svg-0

MathML WPT Tests:
https://github.com/web-platform-tests/wpt/tree/master/mathml/relations/html5-tree

Activity

  1. added
    MathML Core
    need polyfill
    need resolution
    need specification update
    need tests
    on Jun 10, 2019
  2. fred-wang commented on Jun 10, 2019

    @fred-wang
    Author

    cc @annevk @sideshowbarker @bkardell @rwlbuis

    I'd like to better align all these definitions (at least Core and WHATWG) and not refer to the validator schema. Some things to consider:

    1. <math> is allowed in <foreignObject> per the HTML5 spec because it's flow content (probably the validator schema should do common.elem.flow |= math).
    2. <svg> is allowed in <annotation-xml> per the HTML5 spec because it's flow content (probably the validator schema should do common.elem.flow |= svg). I believe we can remove the restriction on the encoding attribute (see also Simplification of the <semantics> element mathml-polyfills#33).
    3. The validator allows <html> in <annotation-xml> but I'm not sure that's true per the HTML5 spec. The MathML full spec contains such an example https://mathml-refresh.github.io/mathml/chapter5.html contains such an example. Do we really want that? If so, can the restriction on the encoding attribute be removed (see issue Simplification of the <semantics> element mathml-polyfills#33)?
    4. Should we allow foreign content in <mtext> only or in any token element? Should we instead have some generic foreignObject-like MathML element?
  3. fred-wang commented on Jun 12, 2019

    @fred-wang
    Author

    I've improved a bit the description of HTML parsing:
    https://mathml-refresh.github.io/mathml-core/#web-platform-integration

    My proposal is the following:

    It seems the only controversial change is whether to allow phrasing content in mi, mo, mn, ms too. Some arguments:

    • That would allow to get rid of the mglyph element Remove/Deprecate mglyph element #25, since you can then e.g. use an "img" tag inside the token element instead.
    • More generally, it's good to be able to tag a foreign element with a special type, e.g. <mn><input id="number" type="number" value="42"></input></mn> is more correct for MathML authors than using mtext. Or you can use <mo><select>my list of operators</select></mo> with custom lspace/rspace attributes which is not possible with mtext etc
    • This is already in the HTML5 spec, so it seems a bug in the checker :-)
    • This is relaxing the restriction, so shouldn't break backward compatibility.
    • This might require some special handling in the MathML browser implementation, but it does not seem harder than the mtext case.

    Also this is perhaps a separate discussion, but we might want to allow foreign content in mrow that accept phrasing content (or introduce a foreignObject-like MathML element). Rationale:

  4. fred-wang commented on Jun 12, 2019

    @fred-wang
    Author

    @sideshowbarker I think this is a bit a separate discussion, but yes it would make sense to have the HTML checker verify validations against the stricter MathML Core spec (perhaps as a default option). As I understand, Apple's concern is about the fact that a stricter MathML could break backward compatibility, so we are implementing these restrictions under a "MathML Core" flag. But in general there should be no problem with improving or extending MathML support. Note that in this case, my proposal is actually to make things more relaxed (see #101 (comment)).

  5. davidcarlisle commented on Jun 12, 2019

    @davidcarlisle
    Collaborator

    It seems the only controversial change is whether to allow phrasing content in mi, mo, mn, ms too.

    Personally I'd be in favour of this.

    The original description of nesting in mathml suggested html be allowed in all token elements but (as far as I recall the conversations) when the actual merge got specified in whatwg/html5 there was a feeling to be cautious at first and restrict the integration points so just allow mtext (or at least only declare that case as valid input) but if there are no real implementation hurdles here then treating all token elements in the same way (and declaring them valid author input) if they have html would be better.

  6. NSoiffer commented on Jun 17, 2019

    @NSoiffer
    Contributor

    Just want to be clear about the proposal...

    Is the proposal to all foreign content at the character level or token level. That is, is this legal:
    <mn> 23 <input> ... </input> 4 </mn>

    If not, then this isn't a direct replacement for mglyph since that acts as a character. On the other hand, if we say any foreign content must be the entire contents of mn, mtext, etc., then that likely simplifies implementations.

    Personally, I like the idea of a new foreign object element, but I think that ship has sailed.

  7. fred-wang commented on Jun 17, 2019

    @fred-wang
    Author

    Is the proposal to all foreign content at the character level or token level. That is, is this legal:
    <mn> 23 <input> ... </input> 4 </mn>

    Yes AFAIK that's currently legal per the HTML spec, so the proposal is to accept it in core too (rather than following the validator)

  8. fred-wang commented on Jun 17, 2019

    @fred-wang
    Author
  9. removed
    need resolution
    on Jun 17, 2019
  10. NSoiffer commented on May 19, 2020

    @NSoiffer
    Contributor

    This has the 'need-polyfill' label. What needs to be polyfilled?

  11. fred-wang commented on May 19, 2020

    @fred-wang
    Author

    I think this can be removed.

  12. removed
    need polyfill
    need tests
    on May 19, 2020
  13. fred-wang commented on May 19, 2020

    @fred-wang
    Author

    I'm also removing need tests as we already have some and most are in HTML actually. So we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MathML Coreneed specification update

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions