I am creating a list of DomRects like below where the element is just a paragraph. I am getting DomRects with x any y coordinates which could be text nodes or i tags. I can get the i tags with the x and y coordinates using document.elementFromPoint(x,y) but how would. i get a text node with the x and y coordinates.
let range = document.createRange();
range.selectNodeContents(element);
let elementRectangles = range.getClientRects();
for (let i = 0; i < elementRectangles.length; i++) {
let elementRectangle : DOMRect = elementRectangles[i];
//document.elementFromPoint(elementRectangle.x,.elementRectangle.y) this can get i tags, b tags etc
//how do i get text nodes with the coords
}