javascript IE < 9 显示“未找到成员”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7993085/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IE < 9 showing displaying "Member not found"
提问by maan81
I am seeing the "SCRIPT3: Member not found." error in IE < 9 . Looking at various locations, (eg., Member not found IE error (IE 6, 7, 8, 9)) it seems to occur at the setTimeout
inside .hover()
portion.
我看到“SCRIPT3:未找到成员”。IE < 9 中的错误。查看各个位置,(例如,Member not found IE error (IE 6, 7, 8, 9))似乎发生在setTimeout
内部.hover()
。
I followed the steps in the but still am having the same problem. I would be greatful for any help.
我按照 中的步骤操作,但仍然遇到同样的问题。如果有任何帮助,我将不胜感激。
Probably it could also occur at places inside the change()
fn.
可能它也可能发生在change()
fn内部的地方。
I have placed the entire code at : http://jsfiddle.net/f4tZQ/
我已将整个代码放在:http: //jsfiddle.net/f4tZQ/
采纳答案by maan81
After sometime searching, I seems to be affected by jQuery bug. Following the "comment:4" , changing the jQuery-1.6.2.js file, line 3172 solved the problem.
经过一段时间的搜索,我似乎受到了 jQuery 错误的影响。在 "comment:4" 之后,更改 jQuery-1.6.2.js 文件,第 3172 行解决了问题。
if (typeof e.cancelBubble !== 'unknown') { e.cancelBubble = true; }
Don't ask why, but it worked... For some reason jQuery or IE returns 'unknown' here in stead of 'undefined'.
不要问为什么,但它有效......出于某种原因,jQuery 或 IE 在这里返回“未知”而不是“未定义”。
Obtained from :
从...获取 :
Source : http://bugs.jquery.com/ticket/10004
回答by scaryman
For others who get here who don't want to modify the jQuery source...(FOR THE LOVE OF GOD DON'T DO THAT)
对于那些不想修改 jQuery 源代码的人......(为了上帝的爱,不要这样做)
This happens in ie<9 when firing custom events. If you have access to the event before it gets to the point where ie crashes, just travel down the originalEvent chain and set the last one = {};
这发生在 ie<9 触发自定义事件时。如果您可以在事件到达 ie 崩溃点之前访问该事件,只需沿着 originalEvent 链向下移动并设置最后一个 = {};
The below code is for when you are relying jQuery to process the event handlers return value (false
) somewhere down the chain. If you want to cancel the event here, see the comments - wrap a call to e.stopPropagation()
in a try/catch block
下面的代码用于当您依赖 jQuery 处理false
链中某处的事件处理程序返回值 ( ) 时。如果您想取消这里的事件,请参阅评论 -e.stopPropagation()
在 try/catch 块中包装对的调用
var handleAndFire = function(e) {
var ev = new $.Event('stack.overflow');
//you may have to debug and manually inspect to see how
//deep the originalEvents go
//or you could write your own function to traverse
//depth first and find it automatically, I'm lazy.
e.originalEvent.originalEvent = {}; //fix for ie < 9
ev.originalEvent = e;
$(document).trigger(ev);
}
$(document).click(handleAndFire);