jquery - 在高端 PC 上加载网页时,从 Retina.js 收到一些错误
问题描述
我是 JQuery 的初学者,在高端 PC 上测试我的 Web 应用程序时(特别是在使用 windows 10 设置scale and layout>change the size of text apps and other items
为 150% 时)' retina.min.js '显示以下功能的一些错误
功能一
function r(e, t) {
try {
this.path = e;
if (typeof t !== "undefined" && t !== null) {
this.at_2x_path = t;
this.perform_check = false
} else {
this.at_2x_path = e.replace(/\.\w+$/, function (e) {
return "@2x" + e
});
this.perform_check = true
}
}
catch (err) {
alert("Function 1" + err.message);
}
}
错误:功能 1:无法读取 null 的属性“替换”
功能二
r.prototype.check_2x_variant = function (e) {
try {
var n, i = this;
if (this.is_external()) {
return e(false)
} else if (!this.perform_check && typeof this.at_2x_path !==
"undefined" && this.at_2x_path !== null) {
return e(true)
} else if (this.at_2x_path in r.confirmed_paths) {
return e(true)
} else {
n = new XMLHttpRequest;
n.open("HEAD", this.at_2x_path);
n.onreadystatechange = function () {
if (n.readyState != 4) {
return e(false)
}
if (n.status >= 200 && n.status <= 399) {
if (t.check_mime_type) {
var s = n.getResponseHeader("Content-Type");
if (s == null || !s.match(/^image/i)) {
return e(false)
}
}
r.confirmed_paths.push(i.at_2x_path);
return e(true)
} else {
return e(false)
}
};
n.send()
}
} catch (err) {
alert("Function 5 :" + err.message);
}
};
错误:函数 5:无法读取 null 的属性“匹配”
浏览器控制台上的错误消息
retina.min.js:1 Uncaught TypeError: Cannot read property 'replace' of null
at new r (retina.min.js:1)
at new i (retina.min.js:1)
at t.onload (retina.min.js:1)
r @ retina.min.js:1
i @ retina.min.js:1
t.onload @ retina.min.js:1
load (async)
n.init @ retina.min.js:1
(anonymous) @ retina.min.js:1
(anonymous) @ retina.min.js:1
为什么会这样?
它是一个插件,我不知道它是如何工作的,所以我不想把它搞砸。请帮助我..我应该改变什么?
解决方案
推荐阅读
- swift - Xcode 内容通知扩展的签名证书
- javascript - 从 google chrome 扩展程序在后台运行音乐
- javascript - “Progress() 未定义”与 onClick - 但它已定义
- r - 使用 lpSolve 和 for 循环解决 r 中的最大化问题?
- python-3.x - PyCharm 在接受输入之前给出退出代码 0
- r - 在闪亮的应用程序中从文件(即源代码)中读取 R 代码
- java - Jackson 反序列化错误:没有从字符串值反序列化的字符串参数构造函数/工厂方法
- vba - 如何修复计算机锁定时发生的错误?
- google-chrome - 按钮未在 chrome 中显示,但在 safari 中显示
- javascript - 我无法使用 request-promise 发布