Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
364 views
in Technique[技术] by (71.8m points)

jquery - 0x800a139e - JavaScript runtime error: SyntaxError

I'm new to Visual Studio Express 2012 for Windows 8.

I have been able to get a simple app to work just fine, but it would throw the same "exceptions".

So to test, I just started a brand new blank JavaScript project, and just linked the jQuery code in default.html, and ran the debugger, and the following exceptions are still thrown :

Exception was thrown at line 1217, column 4 in ms-appx://xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/Scripts/jquery-2.1.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 1235, column 4 in ms-appx://xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/Scripts/jquery-2.1.1.js
0x800a139e - JavaScript runtime error: SyntaxError

How can I edit the jQuery code or what do I need to do to get rid of this exception being thrown?

The part of the jQuery code where the first exception is being thrown :

assert(function (div) {
    // Support: Windows 8 Native Apps
    // The type and name attributes are restricted during .innerHTML assignment
    var input = doc.createElement("input");
    input.setAttribute("type", "hidden");
    div.appendChild(input).setAttribute("name", "D");

    // Support: IE8
    // Enforce case-sensitivity of name attribute
    if (div.querySelectorAll("[name=d]").length) {
        rbuggyQSA.push("name" + 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"); // *********** THIS IS LINE 1217 ***********
    rbuggyQSA.push(",.*:");
});

The part of the jQuery code where the second exception is being thrown :

if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
    docElem.webkitMatchesSelector ||
    docElem.mozMatchesSelector ||
    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" ); // ***** THIS IS LINE 1235 *****
        rbuggyMatches.push( "!=", pseudos );
    });
}

TooLongDon'tRead - Things I've tried :

From what I understand, it's suppose to throw the exception, however microsoft won't approve an app that is throwing any errors/exceptions... I'm quite confused that there isn't a clear cut answer to this (that is easily found), since it is likely an issue everyone has that uses jquery with visual studio. I even tried using jquery2.02 which people said didn't throw these exceptions , but it still did for me. I tried editing the jquery code myself, but that caused a whole lot of other errors.

I also tried the jquery for windows 8 in nuget (that hasn't been updated in like 2 years)... that I guess was suppose to resolve this stuff, but it actually gave me even more runtime errors.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I encountered a similar issue with jQuery when using IE11. It turns out that even though JQuery 2.1.1 claims to be IE11 compatible, I found that in some situations it's not and returns errors. Try using the most recent JQuery 1.X build. it has the exact same functionality as 2.1.1, but still has the compatibility checks for IE 7, 8 and 9 that were removed in 2.1.1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...