goog.cssom
Functions
addCssRule( cssStyleSheet, cssText, opt_index ) → void
void
Cross browser function to add a CSSRule into a StyleSheet, optionally at a given index.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Throws |
|
addCssText( cssText, opt_domHelper ) → Element
Element
Appends a DOM node to HEAD containing the css text that's passed in.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
getAllCssStyleRules( opt_styleSheet ) → Array<(CSSStyleRule|null)>
Array<(CSSStyleRule|null)>
Recursively gets all CSSStyleRules, optionally starting from a given StyleSheet. Note that this excludes any CSSImportRules, CSSMediaRules, etc..
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getAllCssStyleSheets( opt_styleSheet, opt_includeDisabled ) → Array<(StyleSheet|null)>
Array<(StyleSheet|null)>
Gets all StyleSheet objects starting from some StyleSheet. Note that we want to return the sheets in the order of the cascade, therefore if we encounter an import, we will splice that StyleSheet object in front of the StyleSheet that contains it in the returned array of StyleSheets.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
getAllCssText( opt_styleSheet ) → string
string
Recursively gets all CSS as text, optionally starting from a given StyleSheet.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getCssRuleIndexInParentStyleSheet( cssRule, opt_parentStyleSheet ) → number
number
Get the index of the CSSRule in it's StyleSheet.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
| ||||||||
Throws |
|
getCssRulesFromStyleSheet( styleSheet ) → (CSSRuleList|null)
(CSSRuleList|null)
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.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
| ||||
Throws |
|
getCssTextFromCssRule( cssRule ) → string
string
Gets the cssText from a CSSRule object cross-browserly.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getFileNameFromStyleSheet( styleSheet ) → (string|null)
(string|null)
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.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
| ||||
Throws |
|
getParentStyleSheet( cssRule ) → (StyleSheet|null)
(StyleSheet|null)
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.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
removeCssRule( cssStyleSheet, index ) → void
void
Cross browser function to remove a CSSRule in a StyleSheet at an index.
Parameters |
|
---|
replaceCssRule( cssRule, cssText, opt_parentStyleSheet, opt_index ) → void
void
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.
Parameters |
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Throws |
|
Properties
iframe → {style: goog.cssom.iframe.style}
{style: goog.cssom.iframe.style}
No information.