我是2012 for Windows 8的新手。
我已经能够得到一个简单的应用程序工作很好,但它会抛出同样的“例外”。
因此,为了进行测试,我刚刚启动了一个全新的空白JavaScript项目,并将jQuery代码链接到default.html中,并运行调试器,仍然引发以下异常:
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如何编辑jQuery代码,或者需要做些什么才能消除引发的异常?
jQuery代码中第一个异常被抛出的部分:
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(",.*:");
});jQuery代码中引发第二个异常的部分:
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 );
});
}我试过的东西:
据我所知,它应该抛出异常,但微软不会批准一个应用程序抛出任何错误/异常.我很困惑,没有一个明确的答案(这是很容易找到),因为这可能是每个人都有一个问题,使用jquery与visual。我甚至尝试使用jquery2.02,人们说它没有抛出这些异常,但它仍然适用于我。我尝试自己编辑jquery代码,但这导致了许多其他错误。
我还在nuget中尝试了windows 8的8(已经有两年没有更新了).我想应该解决这个问题,但实际上它给了我更多的运行时错误。
发布于 2014-06-18 12:11:15
在使用jQuery时,我遇到了类似的问题。事实证明,尽管JQuery 2.1.1声称与IE11兼容,但我发现在某些情况下它不是,并返回错误。尝试使用最新的JQuery 1.X构建。它具有与2.1.1完全相同的功能,但仍然对2.1.1中删除的IE7、8和9进行兼容性检查。
发布于 2014-06-12 00:21:14
如果window对象可用,则定义一个window.onerror函数以捕获所有未捕获的异常:
window.onerror = function (message, url, lineNo)
{
console.log('Error: ' + message + '\n' + 'Line Number: ' + lineNo);
return true;
}
console.log(window);
console.log(1=2);参考资料
发布于 2014-11-13 23:12:52
当我将网页从VS10移到VS12时,我也犯了同样的错误。我想问题出在某种程度上与转会有关。我阅读了上述问题和答案,并得出结论,我的错误是使用Windows8.1和IE11进行测试。我用VS12浏览器测试了我的FireFox版本软件,错误已经消失。我不知道如何将IE11中的jQuery修改为构建1.x。如果我这么做了,我会的,因为我希望我的软件使用最流行的浏览器操作。
谢谢你的帮助。
https://stackoverflow.com/questions/24131986
复制相似问题