<mpadded> is only really useful for horizontal spacing when it's possible to add something to the width. For example, if one sets lspace on <mpadded> but does not change the width, then the lspace eats into the width of the content.
MathML 3 had the width="+0.333em" notation for this (with + as the prefix) but this was apparently replaced by a new notation in MathML 4, see this example:
<mrow>
<mi>x</mi>
<mpadded lspace="0.3em" width="calc(100% +0.6em)">
<mi>y</mi>
</mpadded>
<mi>z</mi>
</mrow>
The problem for MathML Core here is that the 100% here refers to the width of the child, and not to the width of the parent, as is the case in CSS.
But there is actually a solution in CSS, with the newly proposed calc-size function. The following actually works correctly in Chrome (which is the only browser currently implementing calc-size):
<math display="block">
<mi>x</mi>
<mpadded lspace="0.16667em" style="width: calc-size(min-content, size + 0.33333em)">
<mi>sin</mi>
</mpadded>
<mi>θ</mi>
</math>
So, I think the spec should be either changed so that:
width on <mpadded> accepts any CSS value (currently only allows length-percentage), so that the new calc-size() can be used there
- support for
calc(100% + 0.333em) is explicitly hard-coded in the spec and is internally translated to calc-size()
- (as David says below)
width accepts calc-size() in addition to length-percentage
<mpadded>is only really useful for horizontal spacing when it's possible to add something to the width. For example, if one setslspaceon<mpadded>but does not change thewidth, then thelspaceeats into the width of the content.MathML 3 had the
width="+0.333em"notation for this (with+as the prefix) but this was apparently replaced by a new notation in MathML 4, see this example:The problem for MathML Core here is that the
100%here refers to the width of the child, and not to the width of the parent, as is the case in CSS.But there is actually a solution in CSS, with the newly proposed calc-size function. The following actually works correctly in Chrome (which is the only browser currently implementing
calc-size):So, I think the spec should be either changed so that:
widthon<mpadded>accepts any CSS value (currently only allowslength-percentage), so that the newcalc-size()can be used therecalc(100% + 0.333em)is explicitly hard-coded in the spec and is internally translated tocalc-size()widthacceptscalc-size()in addition tolength-percentage