Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / undo / undo-after-event-edited.html
blob5148c5e74321ff3ae384f76ceb23f20599179347
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <style>
5 * { display:block; }
6 .collapse { visibility:collapse; }
7 </style>
8 <script>
10 if (window.testRunner) {
11 window.testRunner.dumpAsText();
12 window.testRunner.waitUntilDone();
15 document.designMode = "on";
16 var scriptElements = document.getElementsByTagName("script");
17 scriptElements[0].parentNode.removeChild(scriptElements[0]);
18 var eventHandlerActive = false;
20 function event_handler_webkitEditableContentChanged() {
21 if (eventHandlerActive)
22 return;
23 eventHandlerActive = true;
24 var srcElement = event.srcElement;
25 document.execCommand('InsertText',false,'dummy text');
26 srcElement.textContent = "Pass. Test didn't crash.";
27 eventHandlerActive = false;
28 if (window.testRunner)
29 window.testRunner.notifyDone();
32 document.addEventListener("webkitEditableContentChanged", event_handler_webkitEditableContentChanged, true);
34 function event_handler_DOMCharacterDataModified() {
35 document.execCommand('InsertParagraph',false,false);
38 document.addEventListener("DOMCharacterDataModified", event_handler_DOMCharacterDataModified, false);
40 window.addEventListener("load", function() {
41 var selection=window.getSelection();
42 document.execCommand("SelectAll", false)
43 var range = selection.getRangeAt(0);
44 var documentFragment = range.extractContents();
45 document.execCommand('Undo',false);
46 });
47 </script>
48 </head>
49 <body>
50 <table class="collapse">
51 <caption>
52 original text
53 </caption>
54 </table>
55 </body>
56 </html>