【问题标题】:YUI CustomEvent no errors being reportedYUI CustomEvent 没有报错
【发布时间】:2010-10-06 00:16:05
【问题描述】:

有谁知道如何获取以下内容以报告 javascript 错误? (任何浏览器)


<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>

【问题讨论】:

    标签: yui error-reporting


    【解决方案1】:

    可能是有史以来选择最差的默认设置之一..... YAHOO.util.Event.throwErrors 默认设置为 false,所以如果你想查看错误:

    YAHOO.util.Event.throwErrors = true;

    【讨论】:

    • 毫无疑问这是最令人沮丧的默认设置之一,尤其是如果您是 javascript 新手。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-25
    • 1970-01-01
    • 1970-01-01
    • 2010-10-31
    • 1970-01-01
    相关资源
    最近更新 更多