blob: 14c284e844e2cbc7b97bb3bc7c4750e4b9090004 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<p id="before">Before the contenteditable</p>
<div contentEditable></div>
<p id="after">After the contenteditable</p>
<div id="console"></div>
<script>
description("Ensure that extending a selection skips past a contentEditable.");
var before = document.getElementById("before");
var after = document.getElementById("after");
var sel = window.getSelection();
sel.setBaseAndExtent(before, 0, before, 6);
sel.modify("extend", "forward", "character");
shouldBe("sel.focusNode", "after");
sel.setBaseAndExtent(after, 5, after, 0);
sel.modify("extend", "backward", "character");
shouldBe("sel.focusNode.parentElement", "before");
sel.setBaseAndExtent(before, 0, before, 6);
sel.modify("extend", "forward", "word");
shouldBe("sel.focusNode.parentElement", "after");
sel.setBaseAndExtent(after, 5, after, 0);
sel.modify("extend", "backward", "word");
shouldBe("sel.focusNode.parentElement", "before");
sel.setBaseAndExtent(before, 0, before, 6);
sel.modify("extend", "forward", "line");
shouldBe("sel.focusNode.parentElement", "after");
sel.setBaseAndExtent(after, 5, after, 0);
sel.modify("extend", "backward", "line");
shouldBe("sel.focusNode.parentElement", "before");
</script>
</body>
</html>