Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 262
Sarah Weinberger Avatar asked Feb 28 '13 20:02

Sarah Weinberger


2 Answers

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.

like image 160
Tom McKearney Avatar answered Nov 16 '22 13:11

Tom McKearney


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.

like image 38
Dave Methvin Avatar answered Nov 16 '22 11:11

Dave Methvin