blob: 57c27e5ff5c957e02fef910838f02d99930b5cfc [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.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>
</body>