Fix for checking for HTMLElement type in IE8