您的位置:首页 > Web前端 > Node.js

UE报错:Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element'解决方案

2014-10-09 09:31 513 查看
<span style="font-size:14px;">适用UE富文本编辑器的时候,报错:Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element': The 1st argument provided is either null, or an invalid Attr object.</span>

解决办法:

打开报错文件,文件有两种,一种是压缩过的,一种是未压缩过的

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

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

01switch (ci)
{
02case 'className':
03node[ci] = '';
04break;
05case 'style':
06node.style.cssText = '';
07if (node.getAttributeNode('style')
!== null)
{ // 加判断
08!browser.ie && node.removeAttributeNode(node.getAttributeNode('style'))
09}
10}
压缩过的:直接使用打包后的 min.js,找到(我的是在第40行):

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

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

友情声明:这里需要注意的是,代码某些部分根据UE的版本不同,名字也不近相同,比如:有的版本中,压缩后的d变成了a。基本上大同小异,大家仔细一下就知道了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐