Results 1 to 4 of 4

Thread: Ext.utils.CSS.getRule - always throws error

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8042 in a recent build.
  1. #1
    Sencha User
    Join Date
    Sep 2008
    Posts
    90
    Vote Rating
    38
      0  

    Default Ext.utils.CSS.getRule - always throws error

    Code:
            getRule: function(selector, refreshCache, rawCache) {            var i;
    
                if (refreshCache) {
                    CSS.refreshCache();
                }
                if (!Ext.isArray(selector)) {
                    return rawCache ? rules[selector.toLowerCase()] : rules[selector.toLowerCase()].cssRule;
                }
                for (i = 0; i < selector.length; i++) {
                    if (rules[selector[i]]) {
                        return rawCache ? rules[selector[i].toLowerCase()] : rules[selector[i].toLowerCase()].cssRule;
                    }
                }
                return null;
    },
    nice refactoring it ALWAYS throws an error.

    rules variable comes from!?

    I think the developer forgot a line like:
    var rules = this.getRules(refreshCache);
    Management means doing the things right,
    Leadership means doing the right things.
    www.interpid.eu

  2. #2
    Sencha User
    Join Date
    Sep 2008
    Posts
    90
    Vote Rating
    38
      0  

    Default

    This solution works(at least for my cases)


    Code:
            getRule: function(selector, refreshCache, rawCache) {
                var rules = this.getRules(refreshCache),
                i;
    
    
                if (refreshCache) {
                    CSS.refreshCache();
                }
                if (!Ext.isArray(selector)) {
                    return rawCache ? rules[selector.toLowerCase()] : rules[selector.toLowerCase()].cssRule;
                }
                for (i = 0; i < selector.length; i++) {
                    if (rules[selector[i]]) {
                        return rawCache ? rules[selector[i].toLowerCase()] : rules[selector[i].toLowerCase()].cssRule;
                    }
                }
                return null;
            },
    Management means doing the things right,
    Leadership means doing the right things.
    www.interpid.eu

  3. #3
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,711
    Vote Rating
    242
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,608
    Vote Rating
    59
      0  

    Default

    Fixed method:

    Code:
    getRule: function(selector, refreshCache, rawCache) {
                var i;
    
                if (!rules || refreshCache) {
                    CSS.refreshCache();
                }
                if (!Ext.isArray(selector)) {
                    return rawCache ? rules[selector.toLowerCase()] : rules[selector.toLowerCase()].cssRule;
                }
                for (i = 0; i < selector.length; i++) {
                    if (rules[selector[i]]) {
                        return rawCache ? rules[selector[i].toLowerCase()] : rules[selector[i].toLowerCase()].cssRule;
                    }
                }
                return null;
            },

Posting Permissions

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