title: Listing known CSS classes using Javascript
body: <p>I'm trying to find a good way to collect the names of classes defined in the stylesheets included with a given document. I know about <code>document.StyleSheetList</code> but it doesn't seem like it'd be easy to parse. What I'm looking for is something like, for a stylesheet document such as:</p>
  
  <pre><code>.my_class { 
      background: #fff000; 
  }
  .second_class {
      color: #000000;
  }
  </code></pre>
  
  <p>I could extract an array like <code>["my_class", "second_class"]</code>. This obviously assumes the favorable scenario of a fully loaded dom and stylesheets. </p>
  
  <p>I've been looking everywhere for a good way to do something like this and so far, have made little progress. Does anyone have any idea about how to pull this off? Thanks!</p>