rainflame/pith
The client and server for the Pith discussion project. - rainflame/pith
Finally finished this recursive function that translates a cursor position from a child element to one of its arbitrarily distantly related great-great-…-grandparents some n steps up the DOM tree. For example, taking an index (denoted with #) from some child node:
this# is
And translating that index to be relative to some higher level element:
<b>I <i>think</i> <u>that this# is really</u> fun.</b>
That same index starting index of 4 is now 30 relative to the whole string.
It was an absolute pain to debug and required lots of patient help from @sydney to design.