对象不支持对象IE 8

Ric*_*ler 0 javascript extjs minimize

当我想最小化一个extjs窗口时,它在IE8中不起作用.所有其他浏览器都很好.我得到的错误是指向其中的一行:

iframe.dom.hasOwnProperty
Run Code Online (Sandbox Code Playgroud)

这是不适用于IE8的东西?

还有

iframe.dom.contentWindow.parentLostFocus();
Run Code Online (Sandbox Code Playgroud)

IE中的错误只是说:对象不支持对象.不确定问题是什么.有人有想法吗?

这是焦点

iframe = Ext.get('iframe_{0}'.sprintf(item.itemId));
if(!iframe.dom.hasOwnProperty('contentWindow')) {
  return;
}

if(iframe !== null && iframe.dom && iframe.dom.contentWindow && iframe.dom.contentWindow.parentGotFocus) {
  context.trace('calling parentGotFocus in iframe {0}'.sprintf(item.itemId));
  iframe.dom.contentWindow.parentGotFocus();
} else {
  context.trace('function parentGotFocus not found in iframe {0}'.sprintf(item.itemId));
}
},
Run Code Online (Sandbox Code Playgroud)

And*_* D. 6

IE8及更少版本不支持hasOwnProperty()DOM元素.如果iframe.dom是DOM Node对象,则IE8抛出错误"Object不支持属性或方法".为避免错误,请尝试替换:

iframe.dom.hasOwnProperty("property name");
Run Code Online (Sandbox Code Playgroud)

有:

Object.prototype.hasOwnProperty.call(iframe.dom,"property name");
Run Code Online (Sandbox Code Playgroud)