I am writing code in GWT (Google Web Toolkit) with some embedded JavaScript.
I have a RichTextArea, and I need to find out the absolute character position within that RichTextArea (which is a Document living in an iframe) when I've been supplied with a Selection object (from which I can get Range objects).
The problem is, the Selection/Range api is very relativistically designed - it can tell you what text node you're in, what the parent Element is, etc. but doesn't seem to easily be able to provide the absolute character position within the Document itself.
I've found related questions and issues discussed here, but this one in particular is something I haven't found.
I suppose I could get the text node that the Selection starts in, and search/traverse the Document looking for it and adding character offsets as I go; that seems rather brute-force. Does anyone know if there is a way to get the character offset into the Document of a given Selection/Range more directly? You would think this kind of information would be easily supplied by the browser, but I haven't found a solution to this one.