nodesBetween and ancestor nodes

Say I have a document where positions 35 - 40 are inside a text node which is within a para, in a list item, in a list.

And I do

doc.nodesBetween(35, 40, f)

I expected the callback to get called only with the text node.

But it seems it gets the list, then the list-item, then the para, and then the text node.

Is that right? It’s a bit unclear from the docs.


Yes, it’ll give you all nodes in that range, which includes nodes that cover it.