关于document、window、Element在浏览器的表现:
alert(typeof window); //chorme Object IE Object
alert(typeof Element); //chorme function IE Object
alert(typeof document); //chorme Object IE Object
可以看到Element和window在IE中都是Object类型的。
老版本IE 的 DOM
Element
是没有 hasOwnProperty
方法的。
还有 window
对象也没有 hasOwnProperty
方法。
可以考虑用 Object
对象的 hasOwnProperty
试试。
Object.prototype.hasOwnProperty.call(window, "property")
Object.prototype.hasOwnProperty.call(element, "property")