2025-03-18 19:28:35 +01:00
|
|
|
<!DOCTYPE html>
|
2024-10-12 02:42:55 +02:00
|
|
|
<script src="include.js"></script>
|
|
|
|
|
<p id="a">Simply selectable</p>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
test(() => {
|
|
|
|
|
var selection = window.getSelection();
|
|
|
|
|
var range = document.createRange();
|
|
|
|
|
range.setStart(a.firstChild, 0);
|
|
|
|
|
range.setEnd(a.firstChild, 1);
|
|
|
|
|
selection.addRange(range);
|
|
|
|
|
if (selection.isCollapsed) {
|
|
|
|
|
println(`FAIL: "${selection}" is not collapsed`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
selection.collapseToStart();
|
|
|
|
|
if (!selection.isCollapsed) {
|
|
|
|
|
println(`FAIL: "${selection}" is collapsed`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
selection.removeAllRanges();
|
|
|
|
|
if (!selection.isCollapsed) {
|
|
|
|
|
println(`FAIL: "${selection}" is collapsed`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
println("PASS");
|
|
|
|
|
})
|
|
|
|
|
</script>
|