4 <script type="text/javascript">
7 document.body.appendChild(document.createTextNode(msg + '\n'));
12 if (window.testRunner)
13 testRunner.dumpAsText();
15 var listener = function(e) {
16 var el = document.getElementById('cont');
17 if (el.firstElementChild && el.lastElementChild != el.firstElementChild) {
18 el.lastElementChild.appendChild(el.firstElementChild);
19 el.lastElementChild && el.removeChild(el.lastElementChild);
21 if (e.target.firstChild && e.target.firstChild.className == 'Apple-style-span')
22 e.target.firstChild.innerHTML = e.target.firstChild.innerHTML.split(' ')[0];
24 document.addEventListener("DOMSubtreeModified", listener);
26 var el = document.getElementById('cont');
27 window.getSelection().setBaseAndExtent(document.getElementById('start'), 0, document.getElementById('end'), 0);
28 var str = '<span class="Apple-style-span" style="color: red;"><span>styled</span> <span>content</span></span>';
29 document.execCommand("InsertHTML", false, str);
31 document.removeEventListener("DOMSubtreeModified", listener);
33 log('PASS: No crash.');
38 <body onload="runTests();">
39 <div id="cont" contenteditable="true">
40 <span>This <span id="start">tests</span></span>
41 <span>that we don't crash when <code id="end">mutating</code> the dom</span>
42 <span>during execution of an InsertHTML command.</span>