first-reconnected.html (713B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="resources/utils.js"></script> 6 7 <input autofocus id="i1"> 8 <input autofocus id="i2"> 9 <script> 10 "use strict"; 11 12 promise_test(async () => { 13 const input1 = document.querySelector("#i1"); 14 const input2 = document.querySelector("#i2"); 15 input1.remove(); 16 input2.parentNode.insertBefore(input1, input2); 17 18 await waitUntilStableAutofocusState(); 19 assert_equals(document.activeElement, input2); 20 }, 'The second autofocus element wins if the first autofocus element was ' + 21 'disconnected and reconnected before flushing the autofocus candidates.'); 22 </script>