diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html')
-rw-r--r-- | testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html new file mode 100644 index 0000000000..f361463401 --- /dev/null +++ b/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/first-when-later-but-before.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>The temporally first autofocus in the document wins, even if an element is inserted later that is previous in the document tree</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> + +<script> +"use strict"; + +promise_test(async () => { + const input1 = document.querySelector("input"); + const input2 = document.createElement("input"); + input2.autofocus = true; + document.body.prepend(input2); + + await waitUntilStableAutofocusState(); + assert_equals(document.activeElement, input1); + assert_not_equals(document.activeElement, input2); +}, 'The temporally first autofocus in the document wins, even if an element is inserted later that is previous in the document tree.'); +</script> |