| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"/> |
| <title>MathML tabIndex attribute</title> |
| <link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling"> |
| <link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-top-level-math-element"> |
| <meta name="assert" content="Verify default values for the tabIndex attribute"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script> |
| window.addEventListener("load", function() { |
| test(() => { |
| const mrow = document.getElementById('mrow'); |
| assert_equals(mrow.tabIndex, -1, "no attribute"); |
| mrow.setAttribute("tabindex", "invalid"); |
| assert_equals(mrow.getAttribute("tabindex"), "invalid"); |
| assert_equals(mrow.tabIndex, -1, "invalid"); |
| mrow.setAttribute("tabindex", "9999999999"); |
| assert_equals(mrow.getAttribute("tabindex"), "9999999999"); |
| assert_equals(mrow.tabIndex, -1, "too large integer"); |
| }, "default and invalid values on mrow"); |
| test(() => { |
| const mrowLink = document.getElementById('mrow-link'); |
| assert_equals(mrow.tabIndex, 0, "no attribute"); |
| mrow.setAttribute("tabindex", "invalid"); |
| assert_equals(mrow.getAttribute("tabindex"), "invalid"); |
| assert_equals(mrow.tabIndex, 0, "invalid"); |
| mrow.setAttribute("tabindex", "9999999999"); |
| assert_equals(mrow.getAttribute("tabindex"), "9999999999"); |
| assert_equals(mrow.tabIndex, 0, "too large integer"); |
| }, "default and invalid values on MathML link"); |
| }); |
| </script> |
| </head> |
| <body> |
| <div id="log"></div> |
| <math> |
| <mrow id="mrow" onfocus="alert('fail')"></mrow> |
| <mrow id="mrow-link" href="javascript:alert('fail')" onfocus="alert('fail')"></mrow> |
| </math> |
| </body> |
| </html> |