dynamic-2.html (803B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"/> 5 <title>Dynamic id and style</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#dom-and-javascript"/> 7 <link rel="match" href="dynamic-2-ref.html"/> 8 <meta name="assert" content="Verify dynamic change of id and style attributes."> 9 <style> 10 #fail, #fail2 { background: red; color: white; } 11 #pass { background: green; color: white; } 12 </style> 13 <script> 14 window.addEventListener("DOMContentLoaded", function() { 15 document.getElementById("fail2").setAttribute("id", "pass"); 16 document.getElementById("fail").setAttribute("style", "display: none"); 17 }); 18 </script> 19 </head> 20 <body> 21 <p>Test passes if you see the text "PASS".</p> 22 <math> 23 <mtext id="fail">FAIL</mtext> 24 <mtext id="fail2">PASS</mtext> 25 </math> 26 </body> 27 </html>