NodeRange parent

When I select text in a single paragraph and create a node range from that selection the parent of the node range is set to the document node and not the paragraph that has the entire selection. Why is that? When the entire selection is inside a single paragraph the parent should be that paragraph?

If you use blockRange, you’ll get a range of block nodes. Since the paragraph is the closest block, it’ll be the thing that the range covers. Since the paragraph’s parent is the document, the range points into the positions before and after the paragraph in the document.

makes sense with the block range, but a node range can in theory have a paragraph as the parent if it’s created some other way?

Yes, you could call its constructor directly to create a range around some inline node if you need that.