2010-02-09 19:09:59 +03:00
|
|
|
<!DOCTYPE HTML><html><head>
|
2011-06-29 22:22:39 +04:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
2010-02-09 19:09:59 +03:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div contentEditable="true" id="div"><p id="p">BC</p></div>
|
|
|
|
<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 17:38:45 +04:00
|
|
|
sendKey('UP'); // move UP
|
|
|
|
sendChar('A'); // insert "A"
|
2010-02-09 19:09:59 +03:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|