Tôi đang ở thời điểm này chỉ bao gồm jQuery (1.9.1, nhưng cũ 1.8.3 hoạt động theo cách tương tự) trong trang web ASP.net của tôi (tệp Site.Master thực sự). Mọi thứ hoạt động tốt dưới IE9/Win7-64 nhưng kể từ khi tôi nâng cấp lên IE10 (vẫn còn Win7-64), bây giờ khi tôi chạy trang web cục bộ, chọn Internet Explorer và chạy từ bên trong Visual Studio, tôi nhấn một ngoại lệ.Chạy jQuery bị lỗi trên IE10/Win7
Ngoại lệ là trên dòng 4224 của tệp jquery-1.9.1.js.
// 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, cả cũ và mới, dường như không xử lý IE10 trên Windows 7 đúng cách. Tôi gặp tai nạn ở Opera 10-11, điều này thật thú vị.
Tôi cũng thấy một vụ tai nạn trên 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);
});
Đây là một trong các lỗi:
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");
Bất kỳ ai có bất kỳ suy nghĩ?
Ngoại lệ là gì? Dòng nào là dòng 4224 trong mã bạn đăng? –
Tôi đã sao chép ngoại lệ từ hộp thoại vào câu hỏi của tôi, xem ở trên. –
Theo nhóm jQuery, điều này là tốt, vì nó dự kiến. Họ bắt được ngoại lệ ở cấp độ cao hơn và tự xử lý nó. Lame, nhưng đó là tình huống –