| <!DOCTYPE html> |
| <html> |
| <body> |
| <p id="description">This tests inserting a text in the middle of a text node. You should see "1 Two 3" below.</p> |
| <pre id="test" contentEditable="true" style="border:1px solid black"> |
| <b>1 <i>2 3</i></b> |
| </pre> |
| <script src="../../resources/dump-as-markup.js"></script> |
| <script> |
| getSelection().selectAllChildren(document.querySelector('i')); |
| var text = document.querySelector('i').firstChild; |
| getSelection().setBaseAndExtent(text, 0, text, 1); |
| document.execCommand('InsertHtml', false, 'Two'); |
| |
| Markup.description(document.getElementById('description').textContent); |
| Markup.dump('test'); |
| |
| </script> |
| </body> |
| </html> |