blob: c3049867b050984798f8d25cc6ac2fd0d57c54be [file]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="content" role="group">
<p>Think <em>different</em> <a href="apple.com">Apple</a></p>
<p><b>bold</b> <i>italic</i><br><u>underline</u> <em>last!</em></p>
<button>Hello World!</button>
</div>
<script>
if (window.accessibilityController) {
let output = "This tests that textMarkerRangeForRange works properly.\n\n";
let content = accessibilityController.accessibleElementById("content");
let range = content.textMarkerRangeForElement(content);
let contentLength = content.stringForTextMarkerRange(range).length;
output += `content length: ${contentLength}\n`;
output += "All ranges from index 0 to each character in the text:\n";
for (i = 0; i < contentLength; ++i) {
range = content.textMarkerRangeForRange(0, i);
output += `${i} '${content.stringForTextMarkerRange(range)}'\n`;
}
output += "Get the range for the word Apple:\n";
range = content.textMarkerRangeForRange(16, 5);
output += `'${content.stringForTextMarkerRange(range)}'\n`;
output += "Out of range values:\n";
range = content.textMarkerRangeForRange(0, 100);
output += `'${content.stringForTextMarkerRange(range)}'\n`;
range = content.textMarkerRangeForRange(70, 100);
output += `'${content.stringForTextMarkerRange(range)}'\n`;
document.getElementById("content").style.visibility = "hidden";
debug(output);
}
</script>
</body>
</html>