select-overflow.html (690B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <script> 4 function selectEnd() { 5 e = document.getElementById('e'); 6 // Make sure we are at the beginning 7 e.scrollLeft = 0; 8 e.setSelectionRange(e.value.length, e.value.length); 9 // Focusing scrolls to where the cursor is 10 e.focus(); 11 window.requestAnimationFrame(() => { 12 // Now take the cursor out of equation 13 e.blur(); 14 window.requestAnimationFrame(() => { 15 document.documentElement.removeAttribute("class"); 16 }); 17 }); 18 } 19 </script> 20 <body onload="selectEnd();"> 21 <input 22 id="e" 23 style="padding: 100px; width: 200px;" 24 type="text" 25 value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab">