The quick brown fox jumps over the lazy dog. Ranges can start inside one text node and end inside another.
Nested bold with italic inside it shows how the common ancestor climbs to the nearest shared element.
- First list item
- Second item with bold
Debug the Selection and Range APIs visually: container paths, offsets and rect overlays. Free, runs fully in your browser.
Visual Range debugger with DOM tree offsets
How to play
Drag across the sample article to make a selection (try spanning bold and italic text), then press Inspect selection. The tool maps every range to its DOM containers, offsets and screen rects.
The quick brown fox jumps over the lazy dog. Ranges can start inside one text node and end inside another.
Nested bold with italic inside it shows how the common ancestor climbs to the nearest shared element.
Inspect a selection to see each range's containers, offsets and rects.
Offsets mean different things per node type: a character index inside a text node, or a child index inside an element. The path shows exactly which.
// Inspect the live selection
const sel = window.getSelection();
for (let i = 0; i < sel.rangeCount; i++) {
const r = sel.getRangeAt(i);
console.log("start:", r.startContainer, r.startOffset);
console.log("end:", r.endContainer, r.endOffset);
console.log("collapsed:", r.collapsed, "text:", r.toString());
console.log("rects:", r.getClientRects().length);
}
// Programmatic selection: select word under the caret
sel.collapseToStart();
sel.modify("extend", "backward", "word");
sel.modify("extend", "forward", "word");
// Select all inside an element
const range = document.createRange();
range.selectNodeContents(document.querySelector("#article"));
sel.removeAllRanges();
sel.addRange(range);5 of 5 free copies left.
IconVault's Selection and Range Playground turns text selection into something you can see: select text in the sample article, then inspect the live Selection and every Range with container paths, offsets, the common ancestor and screen rects drawn as overlays. It is free to use and runs fully in your browser with nothing uploaded.
How to use: drag across bold and italic text, press Inspect selection, and read each range's start and end containers. Try select-all, collapse and expand-to-word to see how offsets behave. Perfect for developers building editors, annotations and custom selection UIs.
Watch sorting and searching animate step by step
Write better image alt text with live feedback
Searchable ARIA roles and attributes guide
Step through map, filter, reduce like a debugger
CLI
Coming soon
Figma plugin
Coming soon
VS Code extension
Coming soon
Chrome extension
Coming soon
AI icon generator
Coming soon
Team workspaces
Coming soon