bug989012-3.html (871B)
1 <html class="reftest-wait"> 2 <head> 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 4 <script src="/tests/SimpleTest/EventUtils.js"></script> 5 <style> 6 img { 7 border: solid 1px red; 8 mid-width: 1em; 9 display: inline-block; 10 } 11 </style> 12 </head> 13 <body onload="start()"> 14 <div onfocus="setTimeout(done, 0)" contenteditable>foo<img>bar</div> 15 <script> 16 var div = document.querySelector("div"); 17 function start() { 18 div.focus(); 19 } 20 function done() { 21 var sel = getSelection(); 22 sel.collapse(div, 0); 23 // Press Right four times to set the caret right before "bar" 24 for (var i = 0; i < 4; ++i) { 25 synthesizeKey("KEY_ArrowRight"); 26 } 27 document.documentElement.removeAttribute("class"); 28 } 29 </script> 30 </body> 31 </html>