focus-element-crash.html (935B)
1 <!DOCTYPE html> 2 <html> 3 <meta charset="utf-8"> 4 <meta name="assert" content="focus element adopted or remounted shouldn't crash."> 5 6 <body> 7 8 <!--focus element remounted test case--> 9 <audio onloadstart="select.focus()" src=""></audio> 10 <iframe id="iframe"></iframe> 11 <table id="table"> 12 <td> 13 <select id="select" onblur=";"></select> 14 </td> 15 </table> 16 <script> 17 window.addEventListener("load", _ => iframe.appendChild(table)); 18 </script> 19 20 <!--focus element adopted test case--> 21 <input id="username" type="text" placeholder="username"> 22 <input id="password" type="text" placeholder="password"> 23 </body> 24 <script> 25 let search = document.getElementById("search"); 26 let username = document.getElementById("username"); 27 username.focus(); 28 window.onload = () => document.adoptNode(username); 29 username.addEventListener("blur", function (e) { 30 document.body.append(`event:${e.type} fire.`) 31 }); 32 </script> 33 </html>