在 IE10/Win7 上运行 jQuery 崩溃

Running jQuery crashing on IE10/Win7(在 IE10/Win7 上运行 jQuery 崩溃)

本文介绍了在 IE10/Win7 上运行 jQuery 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前只是在我的 ASP.net 网页(实际上是 Site.Master 文件)中包含 jQuery(1.9.1,但旧 1.8.3 的行为方式相同).在 IE9/Win7-64 下运行一切正常,但自从我升级到 IE10(仍然是 Win7-64)后,现在当我在本地运行网页,选择 Internet Explorer 并从 Visual Studio 中运行时,我遇到了一个异常.

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.

jquery-1.9.1.js 文件的第 4224 行出现异常.

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,无论是旧的还是新的,似乎都不能正确处理 Windows 7 上的 IE10.我在 Opera 10-11 崩溃了,这很有趣.

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

我还看到 4242 发生崩溃

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 );
    });

这是错误之一:

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");

有人有什么想法吗?

推荐答案

jQuery 团队在某些情况下使用异常来实现逻辑流.请参阅我针对 WinJS 应用程序的相同问题提交的此错误:http://bugs.jquery.com/ticket/14123

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

由于异常已处理,他们不认为这是一个问题.我愿意,因为如果没有设置break on throw",它会使调试应用程序变得更加困难.

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.

这篇关于在 IE10/Win7 上运行 jQuery 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 IE10/Win7 上运行 jQuery 崩溃

基础教程推荐