focus.window.js (467B)
1 async_test(t => { 2 const input = document.body.appendChild(document.createElement("input")); 3 input.onfocus = t.step_func(() => { 4 const frame = document.body.appendChild(document.createElement("iframe")), 5 frameW = frame.contentWindow; 6 frameW.onfocus = t.unreached_func(); 7 frame.remove(); 8 frameW.focus(); 9 t.step_timeout(() => { 10 assert_equals(document.activeElement, input); 11 t.done(); 12 }, 100); 13 }); 14 input.focus(); 15 });