Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / insertHTML-mutation-crash.html
blob2c377959806723d250603ae30d2c837124d9a3fb
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script type="text/javascript">
5 function log(msg)
7 document.body.appendChild(document.createTextNode(msg + '\n'));
10 function runTests()
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.');
36 </script>
37 </head>
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>
43 </div>
44 </body>
45 </html>