B2G/gecko/browser/devtools/styleinspector/CssLogic.jsm
/**
   * Retrieve a CssRule object for the given CSSStyleRule. The CssRule object is
   * cached, such that subsequent retrievals return the same CssRule object for
   * the same CSSStyleRule object.
   *
   * @param {CSSStyleRule} aDomRule the CSSStyleRule object for which you want a
   * CssRule object.
   * @return {CssRule} the cached CssRule object for the given CSSStyleRule
   * object.
   */
Retrieve a CssRule object for the given CSSStyleRule. The CssRule object is
cached, such that subsequent retrievals return the same CssRule object for
the same CSSStyleRule object.


Retrieve a CssRule object for the given CSSStyleRule . The CssRule object is cached such that subsequent retrievals return the same CssRule object for the same CSSStyleRule object .
function CssSheet_getRule(aDomRule)
  {
    let cacheId = aDomRule.type + aDomRule.selectorText;
    let rule = null;
    let ruleFound = false;
    if (cacheId in this._rules) {
      for (let i = 0, rulesLen = this._rules[cacheId].length; i < rulesLen; i++) {
        rule = this._rules[cacheId][i];
        if (rule._domRule === aDomRule) {
          ruleFound = true;
          break;
        }
      }
    }
    if (!ruleFound) {
      if (!(cacheId in this._rules)) {
        this._rules[cacheId] = [];
      }
      rule = new CssRule(this, aDomRule);
      this._rules[cacheId].push(rule);
    }
    return rule;
  }
function CssSheet_getRule ( aDomRule ) { let cacheId = aDomRule . type + aDomRule . selectorText ; let rule = null ; let ruleFound = false ; if ( cacheId in this . _rules ) { for ( let i = 0 , rulesLen = this . _rules [ cacheId ] . length ; i < rulesLen ; i ++ ) { rule = this . _rules [ cacheId ] [ i ] ; if ( rule . _domRule === aDomRule ) { ruleFound = true ; break ; } } } if ( ! ruleFound ) { if ( ! ( cacheId in this . _rules ) ) { this . _rules [ cacheId ] = [ ] ; } rule = new CssRule ( this , aDomRule ) ; this . _rules [ cacheId ] . push ( rule ) ; } return rule ; }
Retrieve a CssRule object for the given CSSStyleRule.
Retrieve a CssRule object for the given CSSStyleRule .