dynamic-mtext-like-002.html (2853B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>Dynamic mtext-like elements</title> 6 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#text-mtext"> 8 <script src="/mathml/support/mathml-fragments.js"></script> 9 <meta name="assert" content="Dynamically set children of mtext-like elements."> 10 <style> 11 math { 12 font: 25px/1 Ahem; 13 background: lightblue; 14 } 15 li { 16 padding: 2px; 17 } 18 </style> 19 <link rel="match" href="dynamic-mtext-like-001-ref.html"> 20 <script> 21 window.addEventListener("load", function() { 22 23 // force initial layout so we're sure what we're testing against 24 document.documentElement.getBoundingClientRect(); 25 26 Array.from(document.getElementsByClassName("testedElement")).forEach(e => { 27 if (e.textContent === "") 28 e.textContent = "É"; 29 else if (e.textContent === "X") 30 e.firstChild.data = "pX"; 31 else if (e.textContent === "p") { 32 while (e.firstChild) 33 e.removeChild(e.firstChild); 34 e.insertAdjacentHTML("beforeend", "<span>Xp</span>") 35 } 36 }); 37 38 document.documentElement.classList.remove('reftest-wait'); 39 }); 40 </script> 41 </head> 42 <body> 43 <ol> 44 <li><math><mtext class="testedElement"></mtext></math></li> 45 <li><math><mtext class="testedElement">X</mtext></math></li> 46 <li><math><mtext class="testedElement">p</mtext></math></li> 47 <li><math><mi class="testedElement"></mi></math></li> 48 <li><math><mi class="testedElement">X</mi></math></li> 49 <li><math><mi class="testedElement">p</mi></math></li> 50 <li><math><mn class="testedElement"></mn></math></li> 51 <li><math><mn class="testedElement">X</mn></math></li> 52 <li><math><mn class="testedElement">p</mn></math></li> 53 <li><math><mo class="testedElement"></mo></math></li> 54 <li><math><mo class="testedElement">X</mo></math></li> 55 <li><math><mo class="testedElement">p</mo></math></li> 56 <li><math><mo class="testedElement"></mo></math></li> 57 <li><math><mo class="testedElement">X</mo></math></li> 58 <li><math><mo class="testedElement">p</mo></math></li> 59 <li><math><ms class="testedElement"></ms></math></li> 60 <li><math><ms class="testedElement">X</ms></math></li> 61 <li><math><ms class="testedElement">p</ms></math></li> 62 <!-- HTML parser does not accept span as a child of annotation or 63 annotation-xml, so we can't test dynamic VS static. --> 64 <li><math><annotation class="testedElement"></annotation></math></li> 65 <li><math><annotation class="testedElement">X</annotation></math></li> 66 <li><math><annotation-xml class="testedElement"></annotation-xml></math></li> 67 <li><math><annotation-xml class="testedElement">X</annotation-xml></math></li> 68 </ol> 69 </body> 70 </html>