Running jQuery crashing on IE10/Win7

前端 未结 3 1841
一整个雨季
一整个雨季 2020-12-19 05:50

I am for the moment just including jQuery (1.9.1, but old 1.8.3 behaved the same way) in my ASP.net webpage (Site.Master file actually). Everything worked fine running unde

相关标签:
3条回答
  • 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!?

    0 讨论(0)
  • 2020-12-19 06:37

    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.

    0 讨论(0)
  • 2020-12-19 06:42

    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.

    0 讨论(0)
提交回复
热议问题