Fixes IE11 error and misc selection issues

`getSelectionEnd` function was causing error "Unable to get property
'createRange' of undefined or null reference" in IE11 due to using the
depreciated `document.selection` object. A previous patch attempted to fix
this but it only modified `getSelectionStart` and created new bugs.

When text was selected starting in the middle of the string and a
non-numeric key was pressed in some cases the selection would jump
around incorrectly and not stay the same as it should. This bug would
also sometimes select characters when typing in the middle of a number
when nothing was selected before the keypress.

This patch fixes both of these issues.
Merge pull request #76 from ryanss/ie11-and-selection-fixes

Fixes IE11 error and misc selection issues