Skip to content

Commit dcdade6

Browse files
committed
ported from the comments in issue #227
1 parent 119e34d commit dcdade6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

mathml-safe-list.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## MathML Safe List
2+
3+
### 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.
5+
6+
We recommend the [Sanitzer API](https://wicg.github.io/sanitizer-api/) to sanitize MathML by keeping all elements and attributes except the follwing:
7+
- any common attribute with HTML attributes which need a sanitzation,
8+
- the `maction` and `mphantom` elements (the element can be replaced by their first child), 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.
10+
11+
### Detailed Version
12+
MathML-core considers the following elements and attributes of MathML-core as safe and not needing sanitization:
13+
14+
Safe "as-is" Elements of MathML-core:
15+
`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`
16+
17+
Attributes of MathML-core:
18+
`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`.
19+
20+
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).
21+
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). If removed, the element should be replaced by its first child.
24+
- `maction` is replaced by their first child
25+
- `mphantom` is removed
26+

0 commit comments

Comments
 (0)