Ext.util.CSS IE下小问题

Ext.util.CSS 是直接对样式表进行操作的工具类,可以对某一类元素直接操作设置样式,而避免 dom 循环设置行内样式的效率问题。


问题:


但是他没有考虑 ie 下的 selectorText 返回为大写这一点,那么操作:

 

Ext.util.CSS.getRule(小写选择符)

 

在 IE 就什么也得不到了。


根本原因还是在于 Ext 在对样式做缓存时没有考虑 ie 下大小写因素,源代码如下:

 

rules[ssRules[j].selectorText] = ssRules[j];

 


解决:


修正为 :

 

rules[ssRules[j].selectorText.toLowerCase()] = ssRules[j];

 

另外在读取规则时也要强制转换为小写:

 

/**
    * Gets an an individual CSS rule by selector(s)
    * @param {String/Array} selector The CSS selector or an array of selectors to try. 
The first selector that is found is returned.
    * @param {Boolean} refreshCache true to refresh the internal cache if you have
 recently updated any rules or added styles dynamically
    * @return {CSSRule} The CSS rule or null if one is not found
    */
   getRule : function(selector, refreshCache){
        selector=selector.toLowerCase();

 

就 OK 了

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值