mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
28 lines
813 B
HTML
28 lines
813 B
HTML
<!DOCTYPE html>
|
|
<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>
|