bug956530-1.html (1174B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <style> 4 /* eliminate the blue glow when focusing the element. */ 5 input { 6 background: none; 7 border: none; 8 outline: none; 9 } 10 </style> 11 <script src="/tests/SimpleTest/SimpleTest.js"></script> 12 <script src="/tests/SimpleTest/EventUtils.js"></script> 13 <script> 14 async function test() { 15 let input = document.querySelector("input"); 16 input.setSelectionRange(input.value.length, input.value.length); 17 window.focus(); 18 // Run input.onfocus 19 synthesizeMouseAtCenter(input, {}); 20 // Blur 21 await new Promise(resolve => { SimpleTest.executeSoon(resolve); }); 22 synthesizeMouseAtCenter(document.body, {}); 23 // Run input.onfocus again 24 await new Promise(resolve => { SimpleTest.executeSoon(resolve); }); 25 synthesizeMouseAtCenter(input, {}); 26 // Check the result 27 await new Promise(resolve => { SimpleTest.executeSoon(resolve); }); 28 document.documentElement.removeAttribute("class"); 29 } 30 </script> 31 <body onload="SimpleTest.executeSoon(test);"> 32 <input value="text text text text text" 33 onfocus="this.select();"> 34 </body> 35 </html>