Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question SCRIPT438: Object doesn't support property or method 'keys' for IE

    I found strange for the following code:

    Code:
    var allextRules = Ext.util.CSS.getRules();
    
    Object.keys(allextRules).forEach(function(key) {
        var keyname = key;
        if(keyname.indexOf("js") != -1){
            Ext.util.CSS.removeStyleSheet(keyname);
            console.log(keyname + " Removed");
        }
    });
    When the above work is tested in other browser (say - Google Chrome), there is no error. However, when tested in IE 9, there is error as follows:

    Code:
    SCRIPT438: Object doesn't support property or method 'keys'
    According to this article (https://developer.mozilla.org/en/Jav...ts/Object/keys), the Object.keys is supported by IE.

    Have I miss out something?

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Why don't you test the compatibility code there?
    Code:
    if(!Object.keys) Object.keys = function(o){  
     if (o !== Object(o))  
          throw new TypeError('Object.keys called on non-object');  
     var ret=[],p;  
     for(p in o) if(Object.prototype.hasOwnProperty.call(o,p)) ret.push(p);  
     return ret;  
    }
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •