Properties Methods Events Direct Link

# Class Ext.util.CSS

Package: | Ext.util
Defined In: | CSS.js
Class: | CSS
Extends: | Object

Utility class for manipulating CSS rules
This class is a singleton and cannot be created directly.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---

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`

CSS

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

CSS

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

CSS

refreshCache() : Object
Refresh the rule cache if you have dynamically added stylesheets
Refresh the rule cache if you have dynamically added stylesheets
Parameters:

- None.

Returns:

- `Object`
  An object (hash) of rules indexed by selector

CSS

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

CSS

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

CSS

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

CSS

## Public Events

This class has no public events.