frac-created-dynamically.html (1585B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>mfrac created dynamically</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#fractions-mfrac"> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript"> 8 <meta name="assert" content="A dynamically added mfrac should render like the equivalent markup."> 9 <link rel="match" href="frac-created-dynamically-ref.html"> 10 <script> 11 window.addEventListener("load", function() { 12 13 // force initial layout so we're sure what we're testing against 14 document.documentElement.getBoundingClientRect(); 15 16 var mfrac = document.createElementNS("http://www.w3.org/1998/Math/MathML","mfrac"); 17 var mspace1 = document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace"); 18 mspace1.setAttribute("width", "50px"); 19 mspace1.setAttribute("height", "50px"); 20 mspace1.setAttribute("style", "background: black"); 21 var mspace2 = document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace"); 22 mspace2.setAttribute("width", "50px"); 23 mspace2.setAttribute("height", "50px"); 24 mspace2.setAttribute("style", "background: black"); 25 mfrac.appendChild(mspace1); 26 mfrac.appendChild(mspace2); 27 document.getElementsByTagName("math")[0].appendChild(mfrac); 28 29 document.documentElement.classList.remove('reftest-wait'); 30 }); 31 </script> 32 </head> 33 <body> 34 <p>This test passes if you see a fraction.</p> 35 <math></math> 36 <script src="/mathml/support/feature-detection.js"></script> 37 <script>MathMLFeatureDetection.ensure_for_match_reftest("has_mfrac");</script> 38 </body> 39 </html>