Update detection code to correctly tag Internet Explorer 11 as IE

Thanks Microsoft!
Prevent focus wars (especially prevalent in Internet Explorer)

Adjusting the selected range in the event trap can trigger a new focus
event under some conditions. Prevent this from going into an infinite
loop by ignoring new focus events that arise while currently processing
a focus event.
Merge pull request #811 from peitschie/ie-fixups

Assorted fixes for Internet Explorer 10 + 11