Skip to content

End tag causes two parse errors #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

stevecheckoway
Copy link
Contributor

<math><annotation-xml></svg>x

The </svg> is parsed in foreign context because

  1. The stack of open elements is not empty;
  2. The adjusted current node (annotation-xml element) is not in the
    HTML namespace;
  3. The adjusted current node is not a MathML text integration point;
  4. The adjusted current node is not a MathML text integration point
    (separate condition from 3);
  5. The adjusted current node is a MathML annotation-xml element but
    the token (</svg>) is not a start tag;
  6. The token is not a start tag (also the annotation-xml isn't an HTML
    integration point because it lacks a particular attribute);
  7. The token isn't a character token (also the annotation-xml isn't an
    HTML integration point).

Thus the "any other end tag" clause of 12.2.6.5 "The rules for parsing
tokens in foreign context" applies.

The current node's tag name (annotation-xml) is not the same as the
tag name of the token (svg) so this is a parse error.

Since there's no svg element in the stack of open elements, the loop
in step 3 through 6 of the "any other end tag" clause exits when the
body element is reached. and the token is processed according to the
current insertion mode, "in body."

The </svg> matches the "any other end tag" of "in body." Since the
MathML annotation-xml element is not an HTML element but is special
which is a second parse error.

```
<math><annotation-xml></svg>x
```

The `</svg>` is parsed in foreign context because
1. The stack of open elements is not empty;
2. The adjusted current node (`annotation-xml` element) is not in the
   HTML namespace;
3. The adjusted current node is not a MathML text integration point;
4. The adjusted current node is not a MathML text integration point
   (separate condition from 3);
5. The adjusted current node is a MathML `annotation-xml` element but
   the token (`</svg>`) is not a start tag;
6. The token is not a start tag (also the `annotation-xml` isn't an HTML
   integration point because it lacks a particular attribute);
7. The token isn't a character token (also the `annotation-xml` isn't an
   HTML integration point).

Thus the "any other end tag" clause of 12.2.6.5 "The rules for parsing
tokens in foreign context" applies.

The current node's tag name (`annotation-xml`) is not the same as the
tag name of the token (`svg`) so this is a parse error.

Since there's no `svg` element in the stack of open elements, the loop
in step 3 through 6 of the "any other end tag" clause exits when the
`body` element is reached. and the token is processed according to the
current insertion mode, "in body."

The `</svg>` matches the "any other end tag" of "in body." Since the
MathML `annotation-xml` element is not an HTML element but is special
which is a second parse error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant