Accessing Style Sheets

From Mozilla, it's possible to access all the style sheets. Starting from the document, here's the hierarchy for accessing a particular style within a stylesheet:

  • styleSheets
    • href
    • cssRules
      • type
      • selectorText
      • style
  • a solid circle indicates a list
  • an open circle indicates a property

Filling in some details on the properties:

The URL of the stylesheet
An integer telling which type of rule this is. The only ones we're interested in are the ones of type CSSRule.STYLE_RULE.
The selector and the style. In the following stylesheet rule:
p {color:blue; font-size:24pt;}
the selectorText would be the string p and the style would be an object corresponding to the properties in the braces.

  Multi-Page Strategies  Index JavaScript Access