blob: 277529d82951f4a2bf7deeb7bd50a2657a9164f8 (
plain)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Legacy maction and semantics elements</title>
<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.maction">
<link rel="help" href="https://w3c.github.io/mathml-core/#enlivening-expressions">
<link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.semantics">
<link rel="help" href="https://w3c.github.io/mathml-core/#semantics-and-presentation">
<meta name="assert" content="Legacy maction and semantics elements are handled as mrow with special style">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/feature-detection.js"></script>
<script src="/mathml/support/layout-comparison.js"></script>
<script type="text/javascript">
setup({ explicit_done: true });
window.addEventListener("load", runTests);
function runTests()
{
Array.from(document.getElementsByClassName("TestContainer")).forEach(container => {
const id = container.id;
const math = container.getElementsByTagName("math");
test(function() {
assert_true(MathMLFeatureDetection.has_mspace(), "<mspace> is supported");
const epsilon = 1;
compareLayout(math[0], math[1], epsilon);
}, `Element is laid out as an mrow with only first child displayed (id=${id})`);
test(function() {
assert_true(MathMLFeatureDetection.has_mspace(), "<mspace> is supported");
let firstChild = math[0].firstElementChild.firstElementChild;
for (var child = firstChild; child; child = child.nextElementSibling) {
var style = window.getComputedStyle(child).getPropertyValue("display");
if (child == firstChild) {
assert_equals(style, "math", "First child has display: math");
} else {
assert_equals(style, "none", "Other children have display: none");
}
}
}, `Computed display of children (id=${id})`);
});
done();
}
</script>
<style>
mspace:nth-child(2n) {
background: lightblue;
}
mspace:nth-child(2n+1) {
background: lightgreen;
}
mrow.onlyShowFirstChild > :not(:first-child) {
display: none;
}
</style>
</head>
<body>
<div id="log"></div>
<p class="TestContainer" id="semantics">
<math>
<semantics>
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</semantics>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</mrow>
</math>
</p>
<p class="TestContainer" id="semantics-annotations">
<math>
<semantics>
<mspace width="10px" height="10px"></mspace>
<annotation>ANNOTATION</annotation>
<annotation-xml>ANNOTATION-XML</annotation-xml>
</semantics>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<annotation>ANNOTATION</annotation>
<annotation-xml>ANNOTATION-XML</annotation-xml>
</mrow>
</math>
</p>
<p class="TestContainer" id="maction">
<math>
<maction>
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</maction>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</mrow>
</math>
</p>
<p class="TestContainer" id="maction-toggle">
<math>
<maction actiontype="toggle">
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</maction>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</mrow>
</math>
</p>
<p class="TestContainer" id="maction-toggle-selection">
<math>
<maction actiontype="toggle" selection="3">
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</maction>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<mspace width="10px" depth="10px"></mspace>
<mspace width="10px" height="15px" depth="5px"></mspace>
<mspace width="10px" height="5px" depth="15px"></mspace>
</mrow>
</math>
</p>
<p class="TestContainer" id="maction-statusline">
<math>
<maction actiontype="statusline">
<mspace width="10px" height="10px"></mspace>
<mtext>MESSAGE</mtext>
</maction>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<mtext>MESSAGE</mtext>
</mrow>
</math>
</p>
<p class="TestContainer" id="maction-tooltip">
<math>
<maction actiontype="tooltip">
<mspace width="10px" height="10px"></mspace>
<mtext>MESSAGE</mtext>
</maction>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
<mtext>MESSAGE</mtext>
</mrow>
</math>
</p>
<p class="TestContainer" id="maction-input">
<math>
<maction actiontype="input">
<mspace width="10px" height="10px"></mspace>
</maction>
</math>
<math>
<mrow class="onlyShowFirstChild">
<mspace width="10px" height="10px"></mspace>
</mrow>
</math>
</p>
</body>
</html>
|