Range normalization fix by csillag · Pull Request #238 · openannotation/annotator
This is next attempt at fixing this long-standing issue. Some background: When we are normalizing a browser range, we must find a text node and offset to point to, even if the browser range is pointing to some other (nearby) node element. (p, div, br, img, whatever). To do this, we must do some DOM crawling. Earlier we were trying to take some shortcuts, but that failed on some crazy page structures. Now I added full recursive crawling ability to locate the wanted text nodes. This fixes all the failing Range test cases, and also fixes #235.