ie8 js未指明的错误_修复ueditor百度编辑器在IE8下shCore.js报错'undefined'错误的问题...
ueditor在IE8下點擊任意文本框報腳本錯誤
錯誤問題:
在IE8下出現腳本錯誤 'undefined' 為空或不是對象 的問題
出現問題的文件為:
行數:299行
文件路徑:ueditor\third-party\SyntaxHighlighter\shCore.js
報錯的代碼為:
299行
real.replace.call(str.toString().slice(match.index), r2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined)
match[i] = undefined;
}
});
錯誤原因為:299行中的
str.toString().slice(match.index)
傳遞進來的str變量未經過判斷
在函數開始處增加
if(str!==undefined) 既可以修復該問題
RegExp.prototype.exec = function (str) {
if(str!==undefined){
var match = real.exec.apply(this, arguments),
name, r2;
if (match) {
// Fix browsers whose `exec` methods don't consistently return `undefined` for
// nonparticipating capturing groups
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
// Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
// matching due to characters outside the match
real.replace.call(str.toString().slice(match.index), r2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined)
match[i] = undefined;
}
});
}
// Attach named capture properties
if (this._xregexp && this._xregexp.captureNames) {
for (var i = 1; i < match.length; i++) {
name = this._xregexp.captureNames[i - 1];
if (name)
match[name] = match[i];
}
}
// Fix browsers that increment `lastIndex` after zero-length matches
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
}
return match;
}
};
總結
以上是生活随笔為你收集整理的ie8 js未指明的错误_修复ueditor百度编辑器在IE8下shCore.js报错'undefined'错误的问题...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tns 连接超时_ORA-12170:T
- 下一篇: qdialog 返回值_python-P