| <!DOCTYPE html> |
| <div id="container"> |
| <p id="description"></p> |
| <div id="sample" contenteditable="true">Foo</div> |
| <iframe id="iframe"></iframe> |
| </div> |
| <div id="console"></div> |
| <script src="../../resources/js-test.js"></script> |
| <script> |
| description('Check we can undo after removing iframe.'); |
| function $(id) { return document.getElementById(id); } |
| |
| var doc = $('iframe').contentDocument; |
| doc.designMode = 'on'; |
| doc.execCommand('SelectAll'); |
| doc.execCommand('InsertHTML', false, 'ONE<iframe id="iframe1"></iframe>'); |
| |
| window.getSelection().collapse($('sample'), 0); |
| document.execCommand('InsertHTML', false, 'One'); |
| document.execCommand('InsertHTML', false, 'Two'); |
| document.execCommand('InsertHTML', false, 'Three'); |
| |
| doc.execCommand('InsertHTML', false, 'TWO<iframe id="iframe2"></iframe>'); |
| doc.execCommand('InsertHTML', false, 'THREE<iframe id="iframe3"></iframe>'); |
| doc.execCommand('Undo'); // Undo 'THREE'; remove IFRAME |
| doc.execCommand('Undo'); // Undo 'TWO'; remove IFRAME |
| shouldBeEqualToString('doc.body.innerHTML', 'ONE<iframe id="iframe1"></iframe>'); |
| |
| document.execCommand('Undo'); // Undo 'Three' |
| $('iframe').remove(); |
| |
| document.execCommand('Undo'); // Undo 'Two' |
| shouldBeEqualToString('$("sample").textContent', 'OneFoo'); |
| |
| if (window.testRunner) |
| $('container').outerHTML = ''; |
| </script> |