Handle empty nodes for binary search

One cornercase of the binary search was that if a non-displayed was selected as a textIndex
then the binary search failed. This commit fixes this.
Now if we choose an empty node, we try its neighboors (recursively within the interval)
and choose the appropriaty non-empty as a test node.

This way, when the html is full of empty nodes, then the binary search
will become linear, but in a normal text it is much faster