diff options
Diffstat (limited to 'testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first.html')
-rw-r--r-- | testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first.html b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first.html new file mode 100644 index 0000000000..02ebb79a3e --- /dev/null +++ b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>The first autofocus in the document wins</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> +<script src="resources/utils.js"></script> + +<input autofocus> +<input autofocus> + +<script> +"use strict"; + +promise_test(async () => { + const [input1, input2] = document.querySelectorAll("input"); + + await waitUntilStableAutofocusState(); + assert_equals(document.activeElement, input1); + assert_not_equals(document.activeElement, input2); +}, 'The first autofocus element in the document should win.'); +</script> |