1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>No spacing in elements</title>
<meta name="assert" content="Spacing is not added around operators when an element does not use mrow layout. However, when the element is embellished, spacing of the core mo is added around it.">
<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
<link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac">
<link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow">
<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
<link rel="help" href="https://w3c.github.io/mathml-core/#prescripts-and-tensor-indices-mmultiscripts">
<link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot">
<link rel="help" href="https://w3c.github.io/mathml-core/#subscripts-and-superscripts-msub-msup-msubsup">
<link rel="help" href="https://w3c.github.io/mathml-core/#underscripts-and-overscripts-munder-mover-munderover">
<script src="/mathml/support/feature-detection.js"></script>
<script src="/mathml/support/fonts.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<script type="text/javascript">
setup({ explicit_done: true });
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
function runTests()
{
Array.from(document.getElementsByClassName("testedElement")).forEach((e) => {
test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
let box = e.getBoundingClientRect();
let spacing = 100;
assert_less_than_equal(box.width, spacing);
}, `Spacing inside <${e.tagName}>.`);
test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
let box = e.parentNode.getBoundingClientRect();
let spacing = 100;
if (e.classList.contains("embellished"))
assert_greater_than_equal(box.width, spacing * 2);
else
assert_less_than_equal(box.width, spacing);
}, `Spacing around <${e.tagName}>.`);
});
done();
}
</script>
<style>
.testedElement {
background: lightgreen;
}
math {
background: lightblue;
}
math, math * {
font: 25px/1 Ahem;
}
</style>
</head>
<body>
<div id="log"></div>
<p>
<math>
<mfrac class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</mfrac>
</math>
</p>
<p>
<math>
<msub class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</msub>
</math>
</p>
<p>
<math>
<msup class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</msup>
</math>
</p>
<p>
<math>
<msubsup class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</msubsup>
</math>
</p>
<p>
<math>
<mmultiscripts class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
<mprescripts/>
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</mmultiscripts>
</math>
</p>
<p>
<math>
<munder class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</munder>
</math>
</p>
<p>
<math>
<mover class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</mover>
</math>
</p>
<p>
<math>
<munderover class="testedElement embellished">
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
<mo lspace="100px" rspace="100px">X</mo>
</munderover>
</math>
</p>
<p>
<math>
<mroot class="testedElement">
<mtext>X</mtext>
<mo lspace="100px" rspace="100px">X</mo>
</mroot>
</math>
</p>
</body>
</html>
|