YUI CustomEvent 没有报告错误 [英] YUI CustomEvent no errors being reported
本文介绍了YUI CustomEvent 没有报告错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道如何让下面的内容报告javascript错误?(任何浏览器)
Does anyone know how to get the below to report a javascript error? (any browser)
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js">
</script>
<script type="text/javascript">
ObjWithEvent = {
testEvent: new YAHOO.util.CustomEvent("testEvent")
};
ObjSubscriber = {
handleTestEvent: function(){
alert('the next line will not show up in the error console');
not_a_valid_function_bro();
}
};
ObjWithEvent.testEvent.subscribe(ObjSubscriber.handleTestEvent);
ObjWithEvent.testEvent.fire();
</script>
</head>
<body>
</body>
推荐答案
可能是有史以来最糟糕的默认设置之一......YAHOO.util.Event.throwErrors 默认设置为 false,因此如果您想查看错误:
Possibly one of the worst chosen default settings ever..... YAHOO.util.Event.throwErrors is set to false by default, so if you want to see errors:
YAHOO.util.Event.throwErrors = true;
YAHOO.util.Event.throwErrors = true;
这篇关于YUI CustomEvent 没有报告错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文