summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/execCommand/insert-remove-block-list-inside-presentational-inline.html
blob: 63347184baf72b163c450e5cc142e2fd380a7036 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
</head>
<body onload="runTest();">
<div id="console"></div>
<div contenteditable="true" id="root"><b>one</b><div><b>two</b></div><div><b>three</b></div><div><br></div></div>
<script>
var root = document.getElementById("root");
function toggleList() {
    var temporaryBlock = document.createElement('div');
    temporaryBlock.style.cssText =  "height: 0";
    temporaryBlock.appendChild(document.createTextNode('x'));
    root.insertBefore(temporaryBlock, root.firstChild);
    document.execCommand('insertUnorderedList');
    root.removeChild(temporaryBlock);
}

function runTest() {
    if (window.testRunner)
        testRunner.dumpAsText();

    description("This test verifies insertUnorderedList can properly undo its own DOM manipulation.");
    root.focus();
    document.execCommand("SelectAll");
    toggleList();
    toggleList();
    toggleList();
    toggleList();
    shouldBeTrue("document.getElementsByTagName('ul').length == 0");

    if (window.testRunner)
        root.parentNode.removeChild(root);
}
</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>