Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /mathml/relations/html5-tree/autofocus-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>MathML autofocus attribute</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<math>
</math>
<input id="input" autofocus value="some input">
<script>
let t = async_test("MathML autofocus on <a> element");
input.addEventListener("focus",
t.unreached_func("focus() shouldn't be called on `<input>`"));
element.addEventListener("focus", t.step_func_done(function(e) {
assert_equals(document.activeElement, element, "<a> element is focused");
assert_true(element.autofocus, "autofocus IDL attribute");
}, "focus() called on <a> element"));
</script>