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:

href
The URL of the stylesheet
type
An integer telling which type of rule this is. The only ones we're interested in are the ones of type CSSRule.STYLE_RULE.
selectorText
style
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