Skip to content

Required number of children #175

Closed
Closed

Description

@NSoiffer

I'm opening this in response to a comment of @fred-wang about some tests I wrote testing how a renderer handles elements that MathML 3 require one or more children:

I don't think the tests for n=1 are correct. It seems to me that all these elements are allowed to have no children. We should only keep the elements that have explicit expected number of children in MathML Core.

This is related to w3c/mathml-core#136 , but I've opened a separate issue because this is about what the spec should require, not the recovery mechanism.

Specifically, this applies to all the elements listed as "1*" (inferred mrow) in the MathML 3 spec. It would be a change to MathML 3 that may or may not have a visual effect depending on the resolution of w3c/mathml-core#136. If 0 elements are considered an error but the recovery mechanism is to add an empty mrow, there is effectly no difference. Similarly, if 0 children are allowed and rendering is implicitly or explictly defined to be equivalent to having an empty mrow, then there is no difference. I did a few spot checks of the current core spec and the descriptions for laying out the elements that I looked at either fall back to mrow's layout or just say "children" and appear to work if there are no children.

Hence, it appears that the only case of a visual difference is if we require 1 or more children and the error recovery mechanism is to layout the element as an mrow. In that case, examples like
<msqrt></msqrt> would not layout as a square root. In the other cases, it would look like a (narrow) square root.

Since I'm in favor of seeing the square root, think we have the following options:

  1. Resolve Interoperable handling of invalid markup  mathml-core#136 according to this comment [add empty mrows/wrap extra childen in an mrow]. As the comment says, this means adding some text to the core spec.
  2. Change the full spec to allow 0 or more children where it currently says 1 or more
  3. Don't change core or full. I don't see anything in full that says what should happen if there aren't the correct number of children, so this difference is potentially not important.

Activity

  1. fred-wang commented on Nov 14, 2019

    @fred-wang

    Hence, it appears that the only case of a visual difference is if we require 1 or more children and the error recovery mechanism is to layout the element as an mrow. In that case, examples like
    <msqrt></msqrt> would not layout as a square root. In the other cases, it would look like a (narrow) square root.

    msqrt does not have any restriction on child count.

  2. NSoiffer commented on Nov 14, 2019

    @NSoiffer
    ContributorAuthor

    It does in MathML 3, hence this needs to be addressed, even if it means we consciously do nothing.

  3. davidcarlisle commented on Nov 14, 2019

    @davidcarlisle
    Collaborator

    @NSoiffer the mml3 schema has the content as ImpliedMrow which is defined by

    ImpliedMrow = MathExpression*

    so allows zero elements.

  4. davidcarlisle commented on Nov 14, 2019

    @davidcarlisle
    Collaborator

    https://www.w3.org/TR/MathML3/chapter3.html#presm.inferredmrow

    says that 1* allows any number of children including 0 the "1" here was intended to denote the conceptual single mrow child,

  5. NSoiffer commented on Nov 14, 2019

    @NSoiffer
    ContributorAuthor

    Good catch. So there is no conflict. I'll 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions