2010-02-09 16:09:59 +00:00
|
|
|
<!DOCTYPE HTML><html><head>
|
2011-06-29 18:22:39 +00:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
2010-02-09 16:09:59 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-01-24 14:18:00 +00:00
|
|
|
<div contentEditable="true" id="div" spellcheck="false"><p id="p">BC</p></div>
|
2010-02-09 16:09:59 +00:00
|
|
|
<script>
|
|
|
|
// Position the caret before the "B"
|
|
|
|
var div = document.getElementById('div');
|
|
|
|
div.focus();
|
|
|
|
var p = document.getElementById('p');
|
|
|
|
var sel = window.getSelection();
|
|
|
|
sel.removeAllRanges();
|
|
|
|
var range = document.createRange();
|
|
|
|
range.setStart(p.firstChild, 0)
|
|
|
|
range.setEnd(p.firstChild, 0);
|
|
|
|
sel.addRange(range);
|
|
|
|
|
2011-12-16 13:38:45 +00:00
|
|
|
sendKey('UP'); // move UP
|
|
|
|
sendChar('A'); // insert "A"
|
2010-02-09 16:09:59 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|