<!DOCTYPE html>
<html>
<body>
<script src="../../resources/dump-as-markup.js"></script>
<script>

if (window.testRunner)
    testRunner.dumpEditingCallbacks();

// Set up the div
var editable = document.createElement('div');
editable.contentEditable = true;
editable.innerHTML = '<a href="#" id="anchor">1</a><div>3</div>';
document.body.appendChild(editable);
editable.focus();

// Edit it with execCommand
var sel = window.getSelection();
sel.setPosition(document.getElementById('anchor'), 1);
document.execCommand("InsertParagraph");
document.execCommand("InsertText", false, "2");

Markup.description('This tests the fix for <rdar://problem/6633727> - Hitting return at the end of a line with an anchor jumps me to the bottom of the message.\n'+
'If the test has passed, the numbers should be in order, and only "1" should be a link.');
Markup.dump(editable);

</script>
</body>
</html>
