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

Ueditor一加载就报错误:

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

在网上看到一篇帖子,完美的解决了这个问题,下面是原网址

     http://www.zhugao.net/today/2014/4471.html

感谢这位的总结。

报错的图片:


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

1 switch (ci) {
2     case 'className':
3         node[ci] = '';
4         break;
5     case 'style':
6         node.style.cssText = '';
7         !browser.ie && node.removeAttributeNode(node.getAttributeNode('style'))
8 }

加一个 if 判断:

01 switch (ci) {
02     case 'className':
03         node[ci] = '';
04         break;
05     case 'style':
06         node.style.cssText = '';
07         if (node.getAttributeNode('style') !== null) { // 加判断
08             !browser.ie && node.removeAttributeNode(node.getAttributeNode('style'))
09         }
10 }

如果是直接使用打包后的 min.js,找到(我的是在第40行):

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

改成:

1 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=”" 后面的逗号改成分号。



  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值