DomRange / getOffset edge cases

Return a null range if getOffset throws an exception, and throw
an exception if we get as far as trying to add the document length
(i.e. node is out of the document).

Change-Id: Idf0820bf29e257623fe262bf47935a01ec7985ed