Ojan suggested that range.getClientsRects on a collapsed range should give
you the same result as if you had inserted an empty text node at that
position in the DOM and called getClientRects on that text node.
I have two weak concerns about that approach. If inserting an empty text
node into the DOM can cause significant changes in layout in some
situations, it could be very difficult to implement ... but right now I
can't think of any such cases. Also, there are situations where inserting an
empty text node into the DOM does not create any CSS box for the text node,
so getClientRects will return an empty list; applications would have to deal
with that possibility.
Apart from those concerns, I think Ojan's suggestion is fine.
Rob
--
"Now the Bereans were of more noble character than the Thessalonians, for
they received the message with great eagerness and examined the Scriptures
every day to see if what Paul said was true." [Acts 17:11]