display-contents.html (1258B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>display: contents</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#css-styling"> 7 <meta name="assert" content="Verify that display: contents computes to display: none"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/mathml/support/mathml-fragments.js"></script> 11 <script> 12 setup({ explicit_done: true }); 13 window.addEventListener("load", runTests); 14 function runTests() { 15 var container = document.getElementById("container"); 16 for (tag in MathMLFragments) { 17 container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`); 18 } 19 test(function() { 20 Array.from(document.getElementsByClassName("element")).forEach(element => { 21 var style = window.getComputedStyle(element); 22 element.setAttribute("style", "display: contents"); 23 assert_equals(style.getPropertyValue("display"), "none", `${tag}`); 24 }); 25 }, "display: contents computes to display: none"); 26 done(); 27 } 28 </script> 29 </head> 30 <body> 31 <div id="log"></div> 32 <div id="container"> 33 <math class="element"></math> 34 </div> 35 </body> 36 </html>