bug989012-3-ref.html (751B)
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="done()" 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 // Set the caret right before "bar" 23 sel.collapse(div.lastChild, 0); 24 document.documentElement.removeAttribute("class"); 25 } 26 </script> 27 </body> 28 </html>