mphantom-001.html (1490B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test the mphantom element</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#making-sub-expressions-invisible-mphantom"> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet"> 8 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 9 <meta name="assert" content="Verify default mphantom style and size."> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <style> 13 math { 14 font: 25px/1 Ahem; 15 } 16 </style> 17 </head> 18 <body> 19 <div id="log"></div> 20 <div> 21 <math> 22 <mrow id="reference"><mtext>AN ERROR</mtext></mrow> 23 <mphantom id="mphantom"><mtext>AN ERROR</mtext></mphantom> 24 </math> 25 </div> 26 <script> 27 setup({ explicit_done: true }); 28 document.fonts.ready.then(() => { 29 test(function () { 30 var style = window.getComputedStyle(document.getElementById("mphantom")); 31 assert_equals(style.visibility, "hidden"); 32 }, "Default CSS properties on mphantom"); 33 34 test(function () { 35 var mphantomBox = document.getElementById("mphantom").getBoundingClientRect(); 36 var referenceBox = document.getElementById("reference").getBoundingClientRect(); 37 assert_equals(mphantomBox.width, referenceBox.width); 38 assert_equals(mphantomBox.height, referenceBox.height); 39 }, "Bounding box is the same as mrow"); 40 41 done(); 42 }); 43 </script> 44 </body> 45 </html>