前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Extjs 3.3 tree以下的版本在IE10无法点击的解决办法

Extjs 3.3 tree以下的版本在IE10无法点击的解决办法

作者头像
游离于山间之上的Java爱好者
发布2022-08-09 15:11:15
4640
发布2022-08-09 15:11:15
举报
文章被收录于专栏:你我杂志刊

距上篇文章已过去好几天了,说好的一周发表1到3篇文章,难道都让狗吃了吗?现在才发布一篇而且还是转载的文章。 好了,闲话少叙,切入正题,Extjs前端框架是比较早的前端mvc框架了,可能很多人都没接触过,而且现在也很少有项目用Extjs框架搭建了,原因是什么?那就不得而知了,有人说是Extjs比较重…… 在使用Extjs3.3及以下的版本,在IE10环境中却无法点击树节点,而在IE的其他版本(IE7,IE8,IE9,IE11)均可正常。经过在网上查找资料得知,原因是因为Extjs3.3的ext-all.js中的getAttribute方法不能兼容IE10出错引起。 以下是Extjs3.3的ext-all.js的getAttribute方法

代码语言:javascript
复制
etAttribute : Ext.isIE ? function(name, ns){
   var d = this.dom,
   type = typeof d[ns + ":" + name];

   if(['undefined', 'unknown'].indexOf(type) == -1){
      return d[ns + ":" + name];
    }
 return d[name];
} : function(name, ns){
   var d = this.dom;
   return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
},

Extjs3.4的ext-all.js的getAttribute方法

代码语言:javascript
复制
getAttribute: (function(){
   var test = document.createElement('table'),
   isBrokenOnTable = false,
   hasGetAttribute = 'getAttribute' in test,
   unknownRe = /undefined|unknown/;

   if (hasGetAttribute) {
    try {
        test.getAttribute('ext:qtip');
     } catch (e) {
       isBrokenOnTable = true;
    }

  return function(name, ns) {
    var el = this.dom,
    value;

   if (el.getAttributeNS) {
     value = el.getAttributeNS(ns, name) || null;
   }

  if (value == null) {
    if (ns) {
      if (isBrokenOnTable && el.tagName.toUpperCase() == 'TABLE') {
        try {
           value = el.getAttribute(ns + ':' + name);
         } catch (e) {
          value = '';
         }
      } else {
        value = el.getAttribute(ns + ':' + name);
    }
  } else {
    value = el.getAttribute(name) || el[name];
  }
 }
 return value || '';
 };
} else {
  return function(name, ns) {
     var el = this.om,
     value,
     attribute;

     if (ns) {
        attribute = el[ns + ':' + name];
        value = unknownRe.test(typeof attribute) ? undefined : attribute;
     } else {
      value = el[name];
     }
   return value || '';
   };
}
  test = null;
})(),

将3.4中的方法覆盖3.3的ext-all.js中,ie10中tree恢复正常。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-04-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 你我杂志刊 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档