Running jQuery crashing on IE10/Win7

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 under IE9/Win7-64 but ever since I upgraded to IE10 (still Win7-64), now when I run the webpage locally, selecting Internet Explorer and run from within Visual Studio, I hit an exception.

The exception is on line 4224 of the jquery-1.9.1.js file.

// Opera 10-12/IE8 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<input type='hidden' i=''/>";
if ( div.querySelectorAll("[i^='']").length ) {
    rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:""|'')" );
}

// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
    rbuggyQSA.push( ":enabled", ":disabled" );
}

// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");

jQuery, both old and new, seems to not handle IE10 on Windows 7 properly. I crash at Opera 10-11, which is interesting.

I also see a crash on 4242

if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
    docElem.mozMatchesSelector ||
    docElem.webkitMatchesSelector ||
    docElem.oMatchesSelector ||
    docElem.msMatchesSelector) )) ) {

    assert(function( div ) {
        // Check to see if it's possible to do matchesSelector
        // on a disconnected node (IE 9)
        support.disconnectedMatch = matches.call( div, "div" );

        // This should fail with an exception
        // Gecko does not error, returns false instead
        matches.call( div, "[s!='']:x" );
        rbuggyMatches.push( "!=", pseudos );
    });

Here is one of the errors:
Exception was thrown at line 4224, column 4 in http://localhost:49928/jquery/jquery-1.9.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Source line: div.querySelectorAll("*,:x");

Anybody have any thoughts?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

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.

Method 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!?


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x