Sencha Documentation
HOME
/
Ext JS
/
4.0
/
API
/
Ext.util.CSS
EDIT
Ext.util.CSS
Overview
Methods
Utility class for manipulating CSS rules
Methods
createStyleSheet
(
String cssText, String id
) : StyleSheet
Creates a stylesheet from a text blob of rules. These rules will be wrapped in a STYLE tag and appended to the HEAD o...
Creates a stylesheet from a text blob of rules. These rules will be wrapped in a STYLE tag and appended to the HEAD of the document.
Parameters
cssText
: String
The text containing the css rules
id
: String
An id to add to the stylesheet for later removal
Returns
StyleSheet
undefined
getRule
(
String/Array selector, Boolean refreshCache
) : CSSRule
Gets an an individual CSS rule by selector(s)
Gets an an individual CSS rule by selector(s)
Parameters
selector
: String/Array
The CSS selector or an array of selectors to try. The first selector that is found is returned.
refreshCache
: Boolean
true to refresh the internal cache if you have recently updated any rules or added styles dynamically
Returns
CSSRule
The CSS rule or null if one is not found
getRules
(
Boolean refreshCache
) : Object
Gets all css rules for the document
Gets all css rules for the document
Parameters
refreshCache
: Boolean
true to refresh the internal cache
Returns
Object
An object (hash) of rules indexed by selector
refreshCache
: Object
Refresh the rule cache if you have dynamically added stylesheets
Refresh the rule cache if you have dynamically added stylesheets
removeStyleSheet
(
String id
) : Void
Removes a style or link tag by id
Removes a style or link tag by id
Parameters
id
: String
The id of the tag
Returns
Void
swapStyleSheet
(
String id, String url
) : Void
Dynamically swaps an existing stylesheet reference for a new one
Dynamically swaps an existing stylesheet reference for a new one
Parameters
id
: String
The id of an existing link tag to remove
url
: String
The href of the new stylesheet to include
Returns
Void
updateRule
(
String/Array selector, String property, String value
) : Boolean
Updates a rule property
Updates a rule property
Parameters
selector
: String/Array
If it's an array it tries each selector until it finds one. Stops immediately once one is found.
property
: String
The css property
value
: String
The new value for the property
Returns
Boolean
true If a rule was found and updated