blob: 0ab3c4516dbc445231f84777ebb07133713a8d27 [file] [log] [blame]
<head>
<script>
if (window.layoutTestController)
layoutTestController.dumpEditingCallbacks();
</script>
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function assert(bool) {
if (!bool)
log("Failure");
else
log("Success");
}
</script>
</head>
<body contentEditable="true">
<p>This tests moving the caret in content of mixed editability. The caret should jump to the next editable region that shares a common editable ancestor when it reaches non-editable content.</p>
<span id="e1">editable</span><span id="e2" contentEditable="false" style="font-weight:bold">noneditable</span><span id="e3">editable</span>
<ul id="console"></ul>
</body>
<script>
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
var s = window.getSelection();
var e1 = document.getElementById("e1");
var e2 = document.getElementById("e2");
var e3 = document.getElementById("e3");
s.setPosition(e1.firstChild, e1.firstChild.length);
s.modify("move", "forward", "character");
assert(s.anchorNode == e3.firstChild && s.anchorOffset == 0);
s.modify("move", "backward", "character");
assert(s.anchorNode == e1.firstChild && s.anchorOffset == e1.firstChild.length);
</script>