okfn/annotator — pull request #289 by abrookins (2013-11-20 18:36:06+00:00)
Title: Fixed an issue with BrowserRange.normalize

If the focusNode of a browser selection had an offset of zero and its
first node was a non-text node that was empty of text nodes, the code
would hit a TypeError. This happened because `normalize` used an index
of -1 (0 - 1) into `@endContainer.childNodes` to find the previous
node.

This change adds a check for the offset if `normalize` did not find a
text node. If the offset is zero, `normalize` passes the endContainer's
previous sibling to `Util.getLastTextNodeUpTo` instead of one of its
`childNodes`.