<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="startHere">
  First text line.<br />
  Second text line.<br />
  Third text line.
</div>
<p>A paragraph to finish.</p>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests direct navigation to the begin and end of the document in caret mode.");

if (window.testRunner && window.internals) {
  internals.settings.setCaretBrowsingEnabled(true);
  testRunner.dumpAsText();
  testRunner.dumpEditingCallbacks();

  startPoint = document.getElementById("startHere");
  window.getSelection().setPosition(startPoint.childNodes.item(0), 5);

  // Move to the beginning and the end of the document.
  testRunner.execCommand("MoveToBeginningOfDocument");
  testRunner.execCommand("MoveToEndOfDocument");

  // Try the same commands modifying the selection.
  testRunner.execCommand("MoveToBeginningOfDocumentAndModifySelection");
  window.getSelection().setPosition(startPoint.childNodes.item(0), 5);
  testRunner.execCommand("MoveToEndOfDocumentAndModifySelection");
}

</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
