blob: c12ab4d5abf1a74cf32512a34bd6bcb32e232612 [file] [log] [blame]
<body>
<p>Test compareBoundaryPoints results in a particular case, see
<a href="https://bugs.webkit.org/show_bug.cgi?id=20738">bug 20738</a>.</p>
<div id='text'>Some text.</div>
<hr />
<div id='output'></div>
<script type="text/javascript">
function log(text) {
var $out = document.getElementById("output");
$out.innerHTML += "<br />" + text;
}
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
var text = document.getElementById("text");
sourceRange = document.createRange();
sourceRange.selectNode(text);
range = document.createRange();
range.setStart(text.firstChild, 1);
range.setEnd(text.firstChild, 2);
log("<ul>" +
"<li>START_TO_START = " + range.compareBoundaryPoints(Range.START_TO_START, sourceRange) +
"</li><li>START_TO_END = " + range.compareBoundaryPoints(Range.START_TO_END, sourceRange) +
"</li><li>END_TO_START = " + range.compareBoundaryPoints(Range.END_TO_START, sourceRange) +
"</li><li>END_TO_END = " + range.compareBoundaryPoints(Range.END_TO_END, sourceRange) +
"</li></ul>");
log((range.compareBoundaryPoints(Range.START_TO_START, sourceRange) == 1
&& range.compareBoundaryPoints(Range.START_TO_END, sourceRange) == 1
&& range.compareBoundaryPoints(Range.END_TO_START, sourceRange) == -1
&& range.compareBoundaryPoints(Range.END_TO_END, sourceRange) == -1) ? "PASS" : "FAIL");
</script>
</body>