title: Invalid procedure call or argument IE issue when iterating through document.styleSheets using $.each()
body: <p>I've written this code that iterates over all global style sheet rules and stores them in an array/object. I use this dictionary-like object later to change global rules rather than setting styles on individual elements.</p>
  
  <p>Following code breaks in IE8 but works fine in Firefox3.7 and Chrome4.</p>
  
  <pre><code>var allRules;
  
  $(function() {
      var fileRules;
      allRules = [];
      $.each(document.styleSheets, function() {
          // get rules for any browser (IE uses rules array)
          fileRules = this.cssRules || this.rules;
          $.each(fileRules, function() {
              allRules[this.selectorText] = this;
          });
      });
  });
  </code></pre>
  
  <p>I get <code>Invalid procedure call or argument</code> error. When I try to debug it, this code sucessfully iterates through two CSS style sheet files with rules but when the second one's iteration is done, it fails.</p>
  
  <p>I can't seem to find an error in this code.</p>