Bugfix for infinite loop and firefox selection workaround

...== displayEnd == 0

Firefox workaround: We do not select white-space only TextNodes because addRange() crashes for them.