fixed HTMLElement check to be compatible with IE8