Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit d337df9

Browse files
committed
Bug 1642664 [wpt PR 23916] - MathML: check that spacing is not added unless mrow layout is used., a=testonly
Automatic update from web-platform-tests MathML: check that spacing is not added unless mrow layout is used. (#23916) This is different from MathML3 which uses "inferred mrow", although the MathML3 spec is not clear how spacing would be handled anyway and whether <inferredmrow><mo></inferredmrow> is embellihed. -- wpt-commits: 6fba8fd9df16c5152392595e6e4f255628b99c74 wpt-pr: 23916 Differential Revision: https://phabricator.services.mozilla.com/D78780
1 parent 12ac6e1 commit d337df9

File tree

1 file changed

+138
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)