inferred-mrow-baseline.html (4853B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Baseline of inferred mrows</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#horizontally-group-sub-expressions-mrow"> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#radicals-msqrt-mroot"> 8 <link rel="help" href="https://w3c.github.io/mathml-core/#style-change-mstyle"> 9 <link rel="help" href="https://w3c.github.io/mathml-core/#error-message-merror"> 10 <link rel="help" href="https://w3c.github.io/mathml-core/#making-sub-expressions-invisible-mphantom"> 11 <link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element"> 12 <link rel="help" href="https://www.w3.org/TR/MathML3/chapter3.html#presm.menclose"> 13 <link rel="help" href="https://w3c.github.io/mathml-core/#adjust-space-around-content-mpadded"> 14 <meta name="assert" content="Baseline for mrow-like elements is correct."> 15 <script src="/mathml/support/feature-detection.js"></script> 16 <script src="/resources/testharness.js"></script> 17 <script src="/resources/testharnessreport.js"></script> 18 <script type="text/javascript"> 19 setup({ explicit_done: true }); 20 window.addEventListener("load", runTests); 21 function runTests() 22 { 23 ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded", "Unknown", "Mtd", "None", "Mprescripts", "Mfenced", "A"].forEach((tag) => { 24 var x = document.getElementById(`above${tag}`).getBoundingClientRect(); 25 var y = document.getElementById(`below${tag}`).getBoundingClientRect(); 26 test(function() { 27 assert_true(MathMLFeatureDetection.has_mspace()); 28 assert_equals(x.bottom, y.top); 29 }, `baseline alignment inside ${tag}`); 30 }); 31 done(); 32 } 33 </script> 34 </head> 35 <body> 36 <div id="log"></div> 37 <p> 38 <math><mrow><mspace id="aboveMrow" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMrow" width="10px" depth="30px" style="background: blue"></mspace></mrow></math> 39 <math><msqrt><mspace id="aboveSqrt" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowSqrt" width="10px" depth="30px" style="background: blue"></mspace></msqrt></math> 40 <math><mstyle><mspace id="aboveStyle" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowStyle" width="10px" depth="30px" style="background: blue"></mspace></mstyle></math> 41 <math><merror><mspace id="aboveError" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowError" width="10px" depth="30px" style="background: blue"></mspace></merror></math> 42 <math><mphantom><mspace style="visibility: visible;" id="abovePhantom" width="10px" height="30px" style="background: purple"></mspace><mspace style="visibility: visible;" id="belowPhantom" width="10px" depth="30px" style="background: blue"></mspace></mphantom></math> 43 <math><mspace id="aboveMath" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMath" width="10px" depth="30px" style="background: blue"></mspace></math> 44 <!-- menclose is treated as <unknown> in MathML Core --> 45 <math><menclose notation="box"><mspace id="aboveMenclose" width="10px" height="30px" style="background: purple" 46 ></mspace><mspace id="belowMenclose" width="10px" depth="30px" style="background: blue"></mspace></menclose></math> 47 <math><mpadded lspace="10px"><mspace id="aboveMpadded" width="10px" height="30px" style="background: purple" 48 ></mspace><mspace id="belowMpadded" width="10px" depth="30px" style="background: blue"></mspace></mpadded></math> 49 <math><unknown><mspace id="aboveUnknown" width="10px" height="30px" style="background: purple" 50 ></mspace><mspace id="belowUnknown" width="10px" depth="30px" style="background: blue"></mspace></unknown></math> 51 <math><mtable><mtr><mtd><mspace id="aboveMtd" width="10px" height="30px" style="background: purple" 52 ></mspace><mspace id="belowMtd" width="10px" depth="30px" style="background: blue"></mspace></mtd></mtr></mtable></math> 53 <math><none><mspace id="aboveNone" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowNone" width="10px" depth="30px" style="background: blue"></mspace></none></math> 54 <math><mprescripts><mspace id="aboveMprescripts" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMprescripts" width="10px" depth="30px" style="background: blue"></mspace></none></math> 55 <math><mfenced><mspace id="aboveMfenced" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMfenced" width="10px" depth="30px" style="background: blue"></mspace></none></math> 56 <math><a><mspace id="aboveA" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowA" width="10px" depth="30px" style="background: blue"></mspace></none></math> 57 </p> 58 </body> 59 </html>