Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/interaction/focus/the-autofocus-attribute/not-on-first-task.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>The element is not focused during the initial parsing task</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#autofocusing-a-form-control:-the-autofocus-attribute">
<link rel="author" title="Domenic Denicola" href="d@domenic.me">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input autofocus>
<input autofocus>
<script>
"use strict";
test(() => {
const input = document.querySelector("input");
assert_equals(document.activeElement, document.body);
assert_not_equals(document.activeElement, input);
});
</script>