Ueditor一加载就报错误: Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element': The 1st argument provided is either null, or an invalid Attr object.报错的图片:


Ueditor一加载就报错误:

    Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element': The 1st argument provided is either null, or an invalid Attr object.


报错的图片:

Ueditor一加载就报Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element'


解决方法,打开报错的js文件,查到以下代码(或者报错的地方):

switch (ci){    
    case 'className':    
    node[ci] = '';    
    break;    
    case 'style':    
    node.style.cssText = '';    
    !browser.ie && node.removeAttributeNode(node.getAttributeNode('style'))    
}


加一个 if 判断:

switch (ci) {
    case 'className':
        node[ci] = '';
        break;
    case 'style':
        node.style.cssText = '';
        if (node.getAttributeNode('style') !== null) { // 加判断
            !browser.ie && node.removeAttributeNode(node.getAttributeNode('style'))
        }
}


如果是直接使用打包后的 min.js,找到:

switch(d){case "className":a[d]="";break;case "style":a.style.cssText="",!m.ie&&a.removeAttributeNode(a.getAttributeNode("style"))}


改成:

switch(d){case "className":a[d]="";break;case "style":a.style.cssText="";if(a.getAttributeNode("style")!==null){!m.ie&&a.removeAttributeNode(a.getAttributeNode("style"))}}

注意 a.style.cssText=”" 后面的逗号改成分号。


上一篇:多说本地化教程及多说个性化显示UA/管理员

下一篇:PHP函数补完,通过字符串调用函数示例

评论列表
发表评论
称呼
邮箱
网址
验证码(*)
热评文章
相关阅读