Running jQuery crashing on IE10/Win7

元气小坏坏 提交于 2019-11-29 10:24:35

the jQuery team uses exceptions in certain situations for logic flow. See this bug I filed for the same problem with WinJS apps: http://bugs.jquery.com/ticket/14123

since the exception's handled, they don't consider it a problem. I do, since it makes debugging the app way harder without "break on throw" set.

So, that's the problem. Nothing you can do about it.

Other than the message, is anything going wrong? As the comment says, "This should fail with an exception." The exception is handled by the assert() method and should not cause the program to terminate. There should be an option in Visual Studio to only show unhandled exceptions.

Further info: This page describes how to find the "JavaScript first chance exceptions" setting in Visual Studio, turning it off should eliminate what you are seeing. Note that you may not want to turn it off if you are debugging promises, the article in the link discusses it further. But I believe jQuery is handling the exception properly in this case and you wouldn't see the message if you weren't running in the debugger.

I experienced the very same issue in Safari on Windows 7 when the debugger was set to break on un-trapped errors. The problem seemed to be that the debugger expected the catch(e) to happen in the same function. If you continue execution statement by statement the catch(e) does pick the error up perfectly well later on in the assert() function :

function assert( fn ) {
    var div = document.createElement("div");

    try {
        return fn( div );
    } catch (e) {
        return false;
    } finally {
        // release memory in IE
        div = null;
    }
}

Frustrating, huh!?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!