blob: 3947e09ce864c7f390a5fbdb4bf3d5f2f95a611e [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test that collapseToStart() and collapseToEnd() throw INVALID_STATE_ERR if no selection is made.");
var sel = window.getSelection();
var textNode = document.createTextNode("abcdef");
document.body.appendChild(textNode);
shouldThrowErrorName("sel.collapseToStart()", "InvalidStateError");
shouldThrowErrorName("sel.collapseToEnd()", "InvalidStateError");
sel.selectAllChildren(textNode);
shouldBe("sel.collapseToStart()", "undefined");
shouldBe("sel.collapseToEnd()", "undefined");
document.body.removeChild(textNode);
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>