Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /mathml/presentation-markup/mrow/mphantom-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test the mphantom element</title>
<link rel="help" href="https://w3c.github.io/mathml-core/#making-sub-expressions-invisible-mphantom">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<meta name="assert" content="Verify default mphantom style and size.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
math {
font: 25px/1 Ahem;
}
</style>
</head>
<body>
<div id="log"></div>
<div>
<math>
<mrow id="reference"><mtext>AN ERROR</mtext></mrow>
<mphantom id="mphantom"><mtext>AN ERROR</mtext></mphantom>
</math>
</div>
<script>
test(function () {
var style = window.getComputedStyle(document.getElementById("mphantom"));
assert_equals(style.visibility, "hidden");
}, "Default CSS properties on mphantom");
test(function () {
var mphantomBox = document.getElementById("mphantom").getBoundingClientRect();
var referenceBox = document.getElementById("reference").getBoundingClientRect();
assert_equals(mphantomBox.width, referenceBox.width);
assert_equals(mphantomBox.height, referenceBox.height);
}, "Bounding box is the same as mrow");
</script>
</body>
</html>