default-properties-on-the-math-root.html (1889B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Default properties on the <math> root</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element"> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet"> 8 <meta name="assert" content="Test properties on the math root set by the UA stylesheet."> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <style> 12 math { 13 font-size: 100px; 14 } 15 .styled { 16 direction: rtl; 17 writing-mode: vertical-lr; 18 text-indent: .5em; 19 letter-spacing: .5em; 20 line-height: .5em; 21 word-spacing: .5em; 22 font-style: italic; 23 font-weight: bold; 24 } 25 </style> 26 27 </head> 28 <body> 29 <div id="log"></div> 30 <div class="styled"> 31 <math id="ua"></math> 32 <math id="author" class="styled"></math> 33 </div> 34 35 <script> 36 function getProperty(id, property) { 37 return window.getComputedStyle(document.getElementById(id))[property]; 38 } 39 [ 40 // Property name, value when specified from the UA, from the author. 41 ["direction", "ltr", "rtl"], 42 ["writing-mode", "horizontal-tb", "horizontal-tb"], // MathML Core level 1 only supports horizontal mode. 43 ["text-indent", "0px", "50px"], 44 ["letter-spacing", "normal", "50px"], 45 ["line-height", "normal", "50px"], 46 ["word-spacing", "0px", "50px"], 47 ["font-style", "normal", "italic"], 48 ["font-weight", "400", "700"] 49 ].forEach(([name, ua_value, author_value]) => { 50 test(function () { 51 assert_equals(getProperty("ua", name), ua_value, "when specified from the UA sheet"); 52 assert_equals(getProperty("author", name), author_value, "when specified by the author"); 53 }, `Value of ${name} on the <math> root`); 54 }); 55 </script> 56 </body> 57 </html>