blob: 1ee46113dec8952b5a6f7868917165637cdbbbe8 [file] [log] [blame]
<html>
<head>
<script>
var output = '';
function selectNodes(a, b) {
getSelection().setBaseAndExtent(a, 1, b, 1);
let node = getSelection().anchorNode;
if (node.nodeType == Node.TEXT_NODE)
node = node.parentNode;
output += node.id + ' ';
}
if (window.testRunner)
testRunner.dumpAsText();
function doIt() {
try {
var x = document.getElementById('x');
var y = document.getElementById('y');
selectNodes(x, y);
selectNodes(y, x);
document.getElementById('result').innerHTML = (output == "x y " ? "PASS" : ("FAIL: " + output));
} catch (e) { alert(e); }
}
</script>
</head>
<body onload="doIt()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=20117">bug 20117</a>:
setBaseAndExtent fails to reverse the current selection.</p>
<div id='x'>Div X</div>
<div id='y'>Div Y</div>
<div id='z'>Div Z</div>
<div id='result'>FAIL (script didn't run)</div>
</body>
</html>