Home

# Library goog.cssom

Function Summary
| `addCssRule(?CSSStyleSheet cssStyleSheet, string cssText, number= opt_index)` Cross browser function to add a CSSRule into a CSSStyleSheet, optionally at a given index.
| `addCssText(string cssText, ?goog.dom.DomHelper= opt_domHelper) ⇒ ?Element` Appends a DOM node to HEAD containing the css text that's passed in.
| `getAllCssStyleRules(?CSSStyleSheet= opt_styleSheet) ⇒ ?Array` Recursively gets all CSSStyleRules, optionally starting from a given CSSStyleSheet. Note that this excludes any CSSImportRules, CSSMediaRules, etc..
| `getAllCssStyleSheets(?CSSStyleSheet= opt_styleSheet, boolean= opt_includeDisabled) ⇒ ?Array` Gets all CSSStyleSheet objects starting from some CSSStyleSheet. Note that we want to return the sheets in the order of the cascade, therefore if we encounter an import, we will splice that CSSStyleSheet object in front of the CSSStyleSheet that contains it in the returned array of CSSStyleSheets.
| `getAllCssText(?CSSStyleSheet= opt_styleSheet) ⇒ string` Recursively gets all CSS as text, optionally starting from a given CSSStyleSheet.
| `getAllCss_(?CSSStyleSheet styleSheet, boolean isTextOutput) ⇒ (Array|null|string)` Recursively gets all CSS text or rules.
| `getCssRuleIndexInParentStyleSheet(?CSSRule cssRule, ?CSSStyleSheet= opt_parentStyleSheet) ⇒ number` Get the index of the CSSRule in it's CSSStyleSheet.
| `getCssRulesFromStyleSheet(?CSSStyleSheet styleSheet) ⇒ ?CSSRuleList` Returns the CSSRules from a styleSheet. Worth noting here is that IE and FF differ in terms of what they will return. Firefox will return styleSheet.cssRules, which includes ImportRules and anything which implements the CSSRules interface. IE returns simply a list of CSSRules.
| `getCssTextFromCssRule(?CSSRule cssRule) ⇒ string` Gets the cssText from a CSSRule object cross-browserly.
| `getFileNameFromStyleSheet(!StyleSheet styleSheet) ⇒ ?string` Cross browser method to get the filename from the StyleSheet's href. Explorer only returns the filename in the href, while other agents return the full path.
| `getParentStyleSheet(?CSSRule cssRule) ⇒ ?CSSStyleSheet` We do some trickery in getAllCssStyleRules that hacks this in for IE. If the cssRule object isn't coming from a result of that function call, this method will return undefined in IE.
| `removeCssRule(?CSSStyleSheet cssStyleSheet, number index)` Cross browser function to remove a CSSRule in a CSSStyleSheet at an index.

`replaceCssRule(?CSSRule cssRule, string cssText, ?CSSStyleSheet= opt_parentStyleSheet, number= opt_index)`

Replace a cssRule with some cssText for a new rule. If the cssRule object is not one of objects returned by getAllCssStyleRules, then you'll need to provide both the styleSheet and possibly the index, since we can't infer them from the standard cssRule object in IE. We do some trickery in getAllCssStyleRules to hack this in.