| <!DOCTYPE html> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="resources/utils.js"></script> |
| |
| <body> |
| <script> |
| 'use strict'; |
| |
| promise_test(async t => { |
| await waitForLoad(window); |
| await timeOut(t, 1000); |
| let element = document.createElement('input'); |
| element.autofocus = true; |
| document.body.appendChild(element); |
| await waitUntilStableAutofocusState(); |
| assert_equals(document.activeElement, element); |
| }, 'Autofocus should work if an element with autofocus is inserted into a ' + |
| 'document which was loaded some time ago.'); |
| </script> |
| </body> |