Skip to content
Permalink
Browse files

Re-orient script block pattern (#22241)

Re-orient the script to the end of the page.  This is common practice, even most of the tests I see use this pattern to avoid complexities of async.  It seems you can wind up with racey false positives the other way that don't actually complete too... I want to shift this next to generate tests for the elements and I can't have it be racing too or it gets quite complex, it seems.
  • Loading branch information
bkardell committed Mar 17, 2020
1 parent c642547 commit d10a20b00ebdc75b0afe454b9e6300f41f6cf169
Showing with 22 additions and 24 deletions.
  1. +22 −24 mathml/relations/html5-tree/tabindex-001.html
@@ -8,36 +8,34 @@
<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, 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 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>
<script>
test(() => {
const mrow = document.getElementById('mrow');
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 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>
</body>
</html>

0 comments on commit d10a20b

Please sign in to comment.
You can’t perform that action at this time.