修复ueditor百度编辑器在IE8下shCore.js报错'undefined'错误的问题
2012-05-29 17:02
531 查看
ueditor在IE8下点击任意文本框报脚本错误
错误问题:在IE8下出现脚本错误 'undefined'为空或不是对象 的问题
出现问题的文件为:
shCore.js
行数: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;
}
};
原文链接: 枫叶博客:http://www.9it.me/article-9.html
相关文章推荐
- 百度编辑器 多图片批量上传 顺序混乱问题 ueditor
- 百度编辑器 Ueditor 上传图片时打开文件夹的延迟问题,点击上传图片弹窗打开慢问题
- 百度UEditor在线编辑器上传图片提示网络连接错误,请检查配置后重试 asp.net 4.0
- 百度ueditor 编辑器使用问题收集
- 记录一下使用百度Ueditor副编辑器的过程及碰到的问题
- 百度ueditor编辑器背景不显示问题
- 百度编辑器(Ueditor)最新版(1.4.3.3)插入锚点失败原因分析及BUG修复
- 解决百度Ueditor编辑器表格不显示边框问题
- ueditor-angular(百度编辑器angular版)中,关于插入图片后不操作,图片无法正常提交的问题;
- IE8 未知的运行时错误(ueditor编辑器在ie8、ie7下出现JS错误的解决方法)
- PDF 补丁丁 0.6.0.3383 版发布(修复书签编辑器坐标定位错误的问题)
- 百度ueditor后端配置错误,未找到上传数据,上传图片的完整步骤以及难点问题!
- ecshop整合ueditor替换百度编辑器 ,解决ie浏览器下宽度为0的问题
- 科室管理系统中,运用百度编辑器(ueditor1_4_3-utf8-jsp)出现的一系列问题!
- asp.net 百度编辑器 UEditor 上传图片 图片上传配置 编辑器配置 网络连接错误,请检查配置后重试
- 解决百度ueditor编辑器内容在jquery.validate中不验证问题
- 百度图表插件Echarts-IE8兼容性问题,错误信息undefined、indexOf(.)
- 百度编辑器 多图片批量上传 顺序混乱问题 ueditor
- 百度编辑器 Ueditor 上传图片时打开文件夹的延迟问题,点击上传图片弹窗打开慢问题
- 解决百度Ueditor编辑器表格不显示边框问题