4 <script type=
"application/javascript">
5 document.designMode =
"on";
6 let selection = window.getSelection();
8 let foo = document.createElement('foo');
9 let div = document.createElement('div');
10 document.documentElement.appendChild(foo);
11 document.documentElement.appendChild(div);
12 foo.outerHTML = '
<foo>';
14 let range = document.createRange();
15 range.selectNode(div);
16 selection.addRange(range);
17 range.setStart(foo,
0);
19 range = document.createRange();
20 range.selectNode(document.documentElement);
21 selection.addRange(range);
23 document.execCommand('insertparagraph', false, null);