restoreSelection throws error in IE9 when aligning text

Added a fallback way of clearing the selection for the times that IE9 throws an error.