blob: e239cdca5ab1761de3b916d49a119da882b5403f (
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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Forced writing-mode on MathML elements</title>
<link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet">
<meta name="assert" content="Test that writing-mode is forced to horizontal-tb on MathML elements.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/mathml-fragments.js"></script>
<style>
/* selector defined in mathml-fragments.js */
.element {
writing-mode: vertical-lr;
padding-block-start: 10px;
padding-block-end: 15px;
padding-inline-start: 20px;
padding-inline-end: 25px;
}
</style>
</head>
<body>
<div id="log"></div>
<div id="container">
<math class="element"></math>
</div>
<script>
var container = document.getElementById("container");
for (tag in MathMLFragments) {
container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`);
}
let unknownElement = FragmentHelper.createElement("unknown");
unknownElement.setAttribute("class", "element");
container.appendChild(unknownElement);
Array.from(document.getElementsByClassName("element")).forEach(element => {
var tag = element.tagName;
var style = window.getComputedStyle(element);
test(function () {
assert_equals(style["writing-mode"], "horizontal-tb");
}, `writing-mode is forced to horizontal-tb on <${tag}> element`);
test(function () {
assert_equals(style["padding-block-start"], style["padding-top"]);
assert_equals(style["padding-block-end"], style["padding-bottom"]);
assert_equals(style["padding-inline-start"], style["padding-left"]);
assert_equals(style["padding-inline-end"], style["padding-right"]);
}, `logical properties interpreted in horizontal-tb on <${tag}> element`);
});
</script>
</body>
</html>
|