| <!DOCTYPE html> |
| <html> |
| <head> |
| <style> |
| #editor { |
| width: 160px; |
| height: 100px; |
| font-family: Ahem; |
| font-size: 50px; |
| border: 1px solid black; |
| } |
| </style> |
| </head> |
| <body> |
| <p>This tests inserting a character after the collapsed space at the end of a line.<br> |
| There should be a space between the last two boxes below, and there should be two boxes on the first line and exactly one box on the second line.</p> |
| <div id="editor" contenteditable>a b</div> |
| <script> |
| |
| var editor = document.getElementById('editor'); |
| editor.focus(); |
| getSelection().collapse(editor.firstChild, 3); |
| |
| document.execCommand('insertText', false, ' '); |
| document.execCommand('insertText', false, 'c'); |
| |
| editor.blur(); |
| |
| </script> |
| </body> |
| </html> |