<!DOCTYPE html>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir=rtl>
<p>Right To Left
<p>Well-formed pair of unicode bidi control characters.
<div>‫b!‬</div>
<div>‪b!‬</div>
<p>Unpaired unicode bidi control characters.
<div>‫b!</div>
<div>‪b!</div>
<p>Empty content inside unicode bidi control characters.
<div>‬‬</div>
<div>‪‪</div>
<div>‫‫</div>
<p>String inside unicode bidi control characters.
<div contenteditable id="test">‬abc‬</div>
<div>‪abc‪</div>
<div>‫abc‫</div>
<p>String around unicode bidi control characters.
<div>def‬abc‬</div>
<div>‬abc‬def</div>
<div>xyz‬abc‬def</div>
<p>Nested unicode bidi control characters.
<div>‪‪b!‬</div>
<div>‫‫b!‬</div>
<div>‬‬b!‬</div>
<div>‬1‫c!‬</div>
<p>Start with different directionality characters.
<div>12‬‪1‬‫</div>
<div>12‬‪</div>
<div>٠١‬‪</div>
<div>ڃڄ‬‪</div>
<div>‬‪</div>
<div>abc‬‪</div>
<div>אב‬‪</div>
</div>
<div>
<p>Left To Right
<p>Well-formed pair of unicode bidi control characters.
<div>‫b!‬</div>
<div>‪b!‬</div>
<p>Unpaired unicode bidi control characters.
<div>‫b!</div>
<div>‪b!</div>
<p>Empty content inside unicode bidi control characters.
<div>‬‬</div>
<div>‪‪</div>
<div>‫‫</div>
<p>String inside unicode bidi control characters.
<div>‬abc‬</div>
<div>‪abc‪</div>
<div>‫abc‫</div>
<p>String around unicode bidi control characters.
<div>def‬abc‬</div>
<div>‬abc‬def</div>
<div>xyz‬abc‬def</div>
<p>Nested unicode bidi control characters.
<div>‪‪b!‬</div>
<div>‫‫b!‬</div>
<div>‬‬b!‬</div>
<div>‬1‫c!‬</div>
<p>Start with different directionality characters.
<div>12‬‪1‬‫</div>
<div>12‬‪</div>
<div>٠١‬‪</div>
<div>ڃڄ‬‪</div>
<div>‬‪</div>
<div>abc‬‪</div>
<div>אב‬‪</div>
</div>
<ul id="console" dir=ltr></ul>
<script>
function log(str)
{
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function assertEqual(message, actual, expected)
{
if (actual != expected)
log("\n" + message + ": Failure, actual: " + actual + "; expected: " + expected);
else
log("\n" + message + ": Success");
}
var test = document.getElementById('test');
var sel = getSelection();
sel.collapse(test.firstChild, 3);
sel.modify("extend", "left", "character");
assertEqual("test id=test: the right-most character of rendering result of <PDF>abc<PDF> in RTL block should be c", sel.toString(), 'c');
</script>
</body>
</html>