blob: 5fabee990f8182a89bc3d7865fe4af7c3d3f0f58 [file] [log] [blame]
<!doctype html>
<p id="start"><span style="font-size: 200%; color:red"> [!(5)#]</span>9abcdefghi</p>
<div id="start2">ABC</div>
<p><span style="font-size: 200%; color:red">(a)</span> bc</p>
<div id="end2">DEF</div>
<p id="end"><span style="font-size: 200%; color:red">[!(3)#]</span>789abcd</p>
<script>
const selection = window.getSelection();
const start = document.getElementById('start');
const end = document.getElementById('end');
// Select "9^abc to 78|9"
selection.collapse(start.lastChild, 1);
selection.extend(end.lastChild, 2);
</script>