The MathML <maction>
element provides a possibility to bind actions to (sub-) expressions. The action itself is specified by the actiontype
attribute, which accepts several values. To specify which child elements are addressed by the action, you can make use of the selection
attribute.
Attributes
- actiontype
- The action which specifies what happens for this element. Possible values are:
statusline
: If there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. The syntax is:<maction actiontype="statusline"> expression message </maction>.
toggle
: When there is a click on the subexpression, the rendering alternates the display of selected subexpressions. Therefore each click increments theselection
value.
The syntax is:<maction actiontype="toggle" selection="positive-integer" > expression1 expression2 expressionN </maction>
.tooltip
: When the pointer moves over the expression, a tooltip box with a message is displayed near the expression.
The syntax is:<maction actiontype="tooltip"> expression message </maction>.
- class, id, style
- Provided for use with stylesheets.
- href
- Used to set a hyperlink to a specified URI.
- mathbackground
- The background color. You can use
#rgb
,#rrggbb
and HTML color names. - mathcolor
- The text color and also the fraction line color. You can use
#rgb
,#rrggbb
and HTML color names. - selection
- The child element which is addressed by the action. The default value is
1
, which is the first child element.
Examples
The following example uses the "toggle" actiontype
:
<math> <maction actiontype="toggle"> <mfrac> <mn>6</mn> <mn>8</mn> </mfrac> <mfrac> <mrow> <mn>3</mn> <mo>⋅</mo> <mn>2</mn> </mrow> <mrow> <mn>4</mn> <mo>⋅</mo> <mn>2</mn> </mrow> </mfrac> <mfrac> <mn>3</mn> <mn>4</mn> </mfrac> </maction> </math>
Specifications
Specification | Status | Comment |
---|---|---|
MathML 3.0 The definition of 'maction' in that specification. |
Recommendation | Current specification |
MathML 2.0 The definition of 'maction' in that specification. |
Recommendation | Initial specification |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
maction | Chrome No support No | Edge No support No | Firefox Full support 1 | IE No support No | Opera No support No | Safari Full support 8 | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
actiontype | Chrome No support No | Edge No support No | Firefox
Full support
1
| IE No support No | Opera No support No | Safari
Full support
8
| WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
4
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
href | Chrome No support No | Edge No support No | Firefox Full support 7 | IE No support No | Opera No support No | Safari Full support 10 | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
mathbackground | Chrome No support No | Edge No support No | Firefox Full support 4 | IE No support No | Opera No support No | Safari Full support 8 | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
mathcolor | Chrome No support No | Edge No support No | Firefox Full support 4 | IE No support No | Opera No support No | Safari Full support 8 | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 4 | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
- See implementation notes.
Gecko-specific notes
- Prior to Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) the non-standard
restyle
value on theactiontype
attribute was supported. This value has been removed. - Prior to Gecko 14.0 (Firefox 14.0 / Thunderbird 14.0 / SeaMonkey 2.11) the
statusline
action type was using a non-standard syntax (see below). This has been fixed to follow the MathML specification.<maction actiontype="statusline#(message)"> (expression) </maction>
- With Gecko 15.0 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12) the
selection
attribute is only taken into account with the actiontype"toggle"
. - Starting with Gecko 16.0 (Firefox 16.0 / Thunderbird 16.0 / SeaMonkey 2.13) the
selection
attribute is also taken into account when an unknownactiontype
is specified. If anactiontype
is not specified (is empty) or when theselection
attribute is invalid, the markup will throw an MathML error (invalid-markup).