Use document.documentMode when detecting IE versions

Closes #1149