Skip to content

Commit 07062ea

Browse files
committed
#227: as discussed in the MathML-Core WG of Jan 27th: ideally keep mphantom and maction, otherwise replace or remove
1 parent 2e2c65d commit 07062ea

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

mathml-safe-list.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
## MathML Safe List
22

33
### Short Version
4-
MathML-core considers all elements and attributes of MathML-core (as listed in [section 2.1 of MathML-core](https://w3c.github.io/mathml-core/#mathml-elements-and-attributes)) as safe and not needing a sanitziation except the following elements.
4+
MathML-core considers all elements and attributes of MathML-core (as listed in [section 2.1 of MathML-core](https://w3c.github.io/mathml-core/#mathml-elements-and-attributes)) as safe and not needing a sanitization except the following elements.
55

66
We recommend the [Sanitzer API](https://wicg.github.io/sanitizer-api/) to sanitize MathML by keeping all elements and attributes except the follwing:
77
- any common attribute with HTML attributes for which need a sanitzation as done in HTML,
8-
- the `maction` elements which should, ideally, be replaced by its first child element, and
9-
- any `annotation` or `annotation-xml` element whose `encoding` attribute is of a media-type that is is either absent or is not among the trusted types or if it contains an `href` attribute, which should be removed.
8+
- the `mphantom` elements which should, ideally, be kept or replaced by an empty `mspace` element
9+
- the `maction` elements which should, ideally, be replaced by an `mrow` element with the same children, and
10+
- any `annotation` or `annotation-xml` element whose `encoding` attribute is of a media-type that is is either absent or is not among the trusted types or if it contains an `href` attribute: the element should, then, be removed.
1011

1112
### Detailed Version
1213
MathML-core considers the following elements and attributes of MathML-core as safe and not needing sanitization:
1314

1415
Safe "as-is" Elements of MathML-core:
15-
`math, merror, mfrac, mi, mmultiscripts, mn, mo, mover, mpadded, mphantom, mprescripts, mroot, mrow, ms, mspace, msqrt, mstyle, msub, msubsup, msup, mtable, mtd, mtext, mtr, munder, munderover, semantics`
16+
`math, merror, mfrac, mi, mmultiscripts, mn, mo, mover, mpadded, mprescripts, mroot, mrow, ms, mspace, msqrt, mstyle, msub, msubsup, msup, mtable, mtd, mtext, mtr, munder, munderover, semantics`
1617

1718
Attributes of MathML-core:
1819
`dir, displaystyle, mathbackground, mathcolor, mathsize, scriptlevel, encoding, display, linethickness, intent and arg`; on `mo` elements: `form, fence, separator, lspace, rspace, stretchy, symmetric, maxsize, minsize, largeop, movablelimits`; on `mpadded` elements: `width, height, depth, lspace, voffset`, on `mspace` elements: `width, height, depth`, on `munderover` elements `accent` and `accentunder`; on `mtd` elements `columnspan` and `rowspan`.
1920

2021
Moreover, the following attributes have their syntax and semantics specified in the HTML specification. The sanitizer behaviour on these attributes should be as is done on HTML elements: `on*, id, class, style, data-*, autofocus, nonce,tabindex` (for example any javascript should be removed).
2122

22-
The elements of MathML-core which need treatment by the sanitizers are the following:
23-
- `annotation` and `annotation-xml` if their `encoding` attribute is not considered of a safe type (e.g. if the encoding is `text/plain` then it could be kept). Sanitization should remove these elements.
24-
- `maction` should be replaced by its first child element.
25-
23+
The elements of MathML-core which need treatment by the sanitizers are the following. The proposed replacements are expressed in order of preference:
24+
- the `mphantom` elements which should, ideally, be kept or replaced by an empty `mspace` element; if no other possibility exists, then remove it,
25+
- the `maction` elements which should, ideally, be replaced by an `mrow` element with the same children; if no other possibility exists, then remove it, and
26+
- any `annotation` or `annotation-xml` element whose `encoding` attribute is of a media-type that is is either absent or is not among the trusted types or if it contains an `href` attribute: the element should, then, be removed.

0 commit comments

Comments
 (0)