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