autofocus-on-stable-document.html (629B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="resources/utils.js"></script> 5 6 <body> 7 <script> 8 'use strict'; 9 10 promise_test(async t => { 11 await waitForLoad(window); 12 await timeOut(t, 1000); 13 let element = document.createElement('input'); 14 element.autofocus = true; 15 document.body.appendChild(element); 16 await waitUntilStableAutofocusState(); 17 assert_equals(document.activeElement, element); 18 }, 'Autofocus should work if an element with autofocus is inserted into a ' + 19 'document which was loaded some time ago.'); 20 </script> 21 </body>