Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML><html><head></head>
2 <body>
3 <div contentEditable="true" id="div" spellcheck="false"><p id="p">ABC</p></div>
4 <script>
5 // Position the caret after the "A"
6 var div = document.getElementById('div');
7 var p = document.getElementById('p');
8 div.focus();
9 var sel = window.getSelection();
10 sel.removeAllRanges();
11 var range = document.createRange();
12 range.setStart(p.firstChild, 1)
13 range.setEnd(p.firstChild, 1);
14 sel.addRange(range);
15 </script>
17 </body>
18 </html>