gpt4 book ai didi

javascript - 当我只包含 jQuery 1.4 库时,出现异常,为什么?

转载 作者:行者123 更新时间:2023-11-29 10:25:31 25 4
gpt4 key购买 nike

在我只包含 jquery 1.3 或 1.4 的地方,我不断收到此错误。

“设置一个只有 getter 的属性”

以及 Firefox 错误控制台中的一长串警告。

这是怎么回事?我找不到关于这个问题的任何信息 =/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link rel="stylesheet" href="css/modules.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
</head>

只是一些警告片段:

Warning: reference to undefined property a[++e] 
Source File: /js/jquery-1.4.2.min.js
Line: 30
Warning: reference to undefined property a[0]
Source File: /js/jquery-1.4.2.min.js
Line: 30
Warning: function oa does not always return a value
Source File: /js/jquery-1.4.2.min.js Line: 18, Column: 165
Source Code: th;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,

最佳答案

你有没有在任何地方使用"use strict";语句?这会导致 ECMAScript5 浏览器对 JavaScript 的解析略有不同,并可能导致其作为错误返回。

您可以删除它来修复错误,但这意味着您不会从 use strict 中受益。请注意,use strict 在执行它的任何范围内都有效。因此,如果您想将 jQuery 加载为非严格的,但让其余代码严格,您可以这样做:

//load jQuery here

//create a scope
(function() {
"use strict";
// your code here
})();

关于javascript - 当我只包含 jQuery 1.4 库时,出现异常,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2388839/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com