mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Update web-platform-tests to revision bc60e6f82132cfc9a5b688c566c7772024b3c15c
This commit is contained in:
parent
449881f566
commit
29156ca9e2
223 changed files with 7517 additions and 2093 deletions
|
@ -0,0 +1,257 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mtext"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mtext"), emToPx, epsilon);
|
||||
}, "mtext is space-like");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mspace"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mspace"), emToPx, epsilon);
|
||||
}, "mspace is space-like");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mrow1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mrow1"), emToPx, epsilon);
|
||||
}, "space-like mrow");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mrow2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mrow2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mrow");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mstyle1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mstyle1"), emToPx, epsilon);
|
||||
}, "space-like mstyle");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mstyle2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mstyle2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mstyle");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mphantom1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mphantom1"), emToPx, epsilon);
|
||||
}, "space-like mphantom");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mphantom2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mphantom2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mphantom");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mpadded1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("mpadded1"), emToPx, epsilon);
|
||||
}, "space-like mpadded");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("mpadded2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("mpadded2"), 2 * emToPx, epsilon);
|
||||
}, "non-space-like mpadded");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mtext is space-like. -->
|
||||
<mtext class="testedElement" id="mtext">X</mtext>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mspace is space-like. -->
|
||||
<mspace class="testedElement" id="mspace" width="25px" height="10px"></mspace>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mrow is space-like when it contains only space-like elements. -->
|
||||
<mrow id="mrow1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mrow is not space-like when it contains a non space-like element
|
||||
such as "mn". -->
|
||||
<mrow id="mrow2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mstyle is space-like when it contains only space-like elements. -->
|
||||
<mstyle id="mstyle1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mstyle>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mstyle is not space-like when it contains a non space-like element
|
||||
such as "mn". -->
|
||||
<mstyle id="mstyle2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mstyle>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mphantom is space-like when it contains only space-like elements.
|
||||
-->
|
||||
<mphantom id="mphantom1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mphantom>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mphantom is not space-like when it contains a non space-like
|
||||
element such as "mn". -->
|
||||
<mphantom id="mphantom2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mphantom>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mpadded is space-like when it contains only space-like elements. -->
|
||||
<mpadded id="mpadded1" class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mpadded>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- mpadded is not space-like when it contains a non space-like element
|
||||
such as "mn". -->
|
||||
<mpadded id="mpadded2" class="testedElement">
|
||||
<mn>X</mn>
|
||||
<mspace width="25px" height="10px"></mspace>
|
||||
</mpadded>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,174 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("maction1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("maction1"), emToPx, epsilon);
|
||||
}, "space-like maction");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("maction2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("maction2"), 2 * emToPx, epsilon);
|
||||
}, "non-space like maction (no first child)");
|
||||
|
||||
test(function() {
|
||||
assert_approx_equals(spaceBefore("maction3"), 0, epsilon);
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceAfter("maction3"), 2 * emToPx, epsilon);
|
||||
}, "non-space like maction (first child not space-like)");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("semantics1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("semantics1"), emToPx, epsilon);
|
||||
}, "space-like semantics");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("semantics2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("semantics2"), 2 * emToPx, epsilon);
|
||||
}, "non-space like semantics (no first child)");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("semantics3"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("semantics3"), 2 * emToPx, epsilon);
|
||||
}, "non-space like semantics (first child not space-like)");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- maction is space-like when its first child exists and is space-like -->
|
||||
<maction id="maction1" class="testedElement" actiontype="statusline">
|
||||
<mtext>X</mtext>
|
||||
<mtext>STATUS MESSAGE</mtext>
|
||||
</maction>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- maction is not space-like when its first does not exist-like -->
|
||||
<maction id="maction2" class="testedElement" actiontype="statusline">
|
||||
</maction>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- maction is not space-like when its first is not space-like -->
|
||||
<maction id="maction3" class="testedElement" actiontype="statusline">
|
||||
<mn>1</mn>
|
||||
<mtext>STATUS MESSAGE</mtext>
|
||||
</maction>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- semantics is space-like when its first child exists and is space-like -->
|
||||
<semantics id="semantics1" class="testedElement" actiontype="statusline">
|
||||
<mtext>X</mtext>
|
||||
<annotation>TEXT ANNOTATION</annotation>
|
||||
</semantics>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- semantics is not space-like when its first does not exist-like -->
|
||||
<semantics id="semantics2" class="testedElement" actiontype="statusline">
|
||||
</semantics>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- semantics is not space-like when its first is not space-like -->
|
||||
<semantics id="semantics3" class="testedElement" actiontype="statusline">
|
||||
<mn>1</mn>
|
||||
<annotation>TEXT ANNOTATION</annotation>
|
||||
</semantics>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,276 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Non space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(element) {
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(element) {
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
Array.from(document.querySelectorAll(".testedElement")).forEach(el => {
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore(el), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter(el), 2 * emToPx, epsilon);
|
||||
}, `${el.tagName} is not space-like`);
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<merror class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
</merror>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mroot class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mroot>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<menclose class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
</menclose>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mfrac class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mfrac>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mi class="testedElement">X</mi>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mmultiscripts class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mmultiscripts>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mn class="testedElement">X</mn>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mo class="testedElement" lspace="0" rspace="0">X</mo>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mover class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mover>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<munder class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</munder>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<ms class="testedElement">X</ms>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<munderover class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</munderover>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msup class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</msup>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msub class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</msub>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msubsup class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</msubsup>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<msqrt class="testedElement">
|
||||
<mtext>X</mtext>
|
||||
</msqrt>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<mtable class="testedElement">
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mtext>X</mtext>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,193 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Space-like elements</title>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#definition-of-space-like-elements">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
|
||||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-of-mrow">
|
||||
<meta name="assert" content="Verify definition of space-like elements">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/mathml/support/feature-detection.js"></script>
|
||||
<style>
|
||||
/* Default spacing of operator 'X' is 0.2777777777777778em so quite different
|
||||
from the measured/specified 0em and 1em. */
|
||||
math, math * {
|
||||
font: 25px/1 Ahem;
|
||||
}
|
||||
mn {
|
||||
color: black;
|
||||
}
|
||||
mo {
|
||||
color: yellow;
|
||||
}
|
||||
.testedElement, .testedElement * {
|
||||
color: blue !important;
|
||||
background: blue !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function spaceBefore(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnBeforeParent = element.parentNode.previousElementSibling;
|
||||
return element.getBoundingClientRect().left - mnBeforeParent.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
function spaceAfter(id) {
|
||||
var element = document.getElementById(id);
|
||||
var mnAfterParent = element.parentNode.nextElementSibling;
|
||||
return mnAfterParent.getBoundingClientRect().left - element.getBoundingClientRect().right;
|
||||
}
|
||||
|
||||
setup({ explicit_done: true });
|
||||
window.addEventListener("load", runTests);
|
||||
|
||||
function runTests() {
|
||||
var epsilon = 1;
|
||||
var emToPx = 25;
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("complex1"), emToPx, epsilon);
|
||||
assert_approx_equals(spaceAfter("complex1"), emToPx, epsilon);
|
||||
}, "complex space-like subtree");
|
||||
|
||||
test(function() {
|
||||
assert_true(MathMLFeatureDetection.has_operator_spacing());
|
||||
assert_approx_equals(spaceBefore("complex2"), 0, epsilon);
|
||||
assert_approx_equals(spaceAfter("complex2"), 2 * emToPx, epsilon);
|
||||
}, "complex non-space-like subtree");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- This element is space-like because it is made of nested
|
||||
mrow, mstyle, mpadded, mphantom, mtext, mspace
|
||||
-->
|
||||
<mrow class="testedElement" id="complex1">
|
||||
<mtext>X</mtext>
|
||||
<mstyle>
|
||||
<mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mtext>X</mtext>
|
||||
<mrow></mrow>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mrow>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mrow>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
</mstyle>
|
||||
<mspace width="25px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
<p>
|
||||
<math>
|
||||
<mn>X</mn>
|
||||
<mrow>
|
||||
<!-- This element is not space-like. It is made of nested
|
||||
mrow, mstyle, mpadded, mphantom, mtext, mspace but contains
|
||||
one non-space like descendant (an mn element).
|
||||
-->
|
||||
<mrow class="testedElement" id="complex2">
|
||||
<mtext>X</mtext>
|
||||
<mstyle>
|
||||
<mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mstyle>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mtext>X</mtext>
|
||||
<mrow></mrow>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mrow>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
</mrow>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mpadded>
|
||||
<mphantom>
|
||||
<mn>X</mn> <!-- mn is not space-like -->
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
<mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mphantom>
|
||||
<mtext>X</mtext>
|
||||
<mtext>X</mtext>
|
||||
<mspace width="25px"></mspace>
|
||||
</mpadded>
|
||||
</mstyle>
|
||||
<mspace width="25px"></mspace>
|
||||
</mrow>
|
||||
<mo lspace="1em" rspace="0em">X</mo>
|
||||
</mrow>
|
||||
<mn>X</mn>
|
||||
</math>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue