OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 <style> |
| 6 #target { |
| 7 display: grid; |
| 8 display: -webkit-grid; |
| 9 } |
| 10 </style> |
| 11 <script> |
| 12 var targetDiv; |
| 13 function test() |
| 14 { |
| 15 targetDiv = document.getElementById('target'); |
| 16 targetDiv.focus(); |
| 17 |
| 18 // Move cursor to the end of line. |
| 19 getSelection().modify('move', 'forward', 'lineboundary'); |
| 20 |
| 21 document.execCommand("insertText", false, "EST"); |
| 22 shouldBeEqualToString("targetDiv.innerText", "TEST"); |
| 23 |
| 24 document.execCommand("delete"); |
| 25 document.execCommand("delete"); |
| 26 document.execCommand("delete"); |
| 27 document.execCommand("delete"); |
| 28 document.execCommand("delete"); // Remove '\n' |
| 29 shouldBeEmptyString("targetDiv.innerText"); |
| 30 |
| 31 document.execCommand("insertText", false, "TEST"); |
| 32 shouldBeEqualToString("targetDiv.innerText", "TEST"); |
| 33 } |
| 34 </script> |
| 35 </head> |
| 36 <body onload="test()"> |
| 37 <div id="target" contentEditable>T</div> |
| 38 </body> |
| 39 </html> |
OLD | NEW |