Package | dom.style.css |
Class | public class CSSRule |
Inheritance | CSSRule Object |
Subclasses | CSSCharsetRule, CSSFontFaceRule, CSSImportRule, CSSMediaRule, CSSPageRule, CSSStyleRule, CSSUnknownRule |
Introduced in: | DOM 2 Core |
This includes both rule sets and at-rules. An implementation is expected to preserve all rules specified in a CSS style sheet, even if the rule is not recognized by the parser. Unrecognized rules are represented using the CSSUnknownRule interface.
See also
Property | Defined By | ||
---|---|---|---|
DOM 2 Style cssText : DOMString [read-only]
The parsable textual representation of the rule. | CSSRule | ||
DOM 2 Style parentRule : CSSRule [read-only]
If this rule is contained inside another rule (e.g. | CSSRule | ||
DOM 2 Style parentStyleSheet : CSSStyleSheet [read-only]
The style sheet that contains this rule. | CSSRule | ||
DOM 2 Style type : Number [read-only]
The type of the rule, as defined above. | CSSRule |
Constant | Defined By | ||
---|---|---|---|
DOM 2 Style CHARSET_RULE : Number = 2
The rule is a CSSCharsetRule. | CSSRule | ||
DOM 2 Style FONT_FACE_RULE : Number = 5
The rule is a CSSFontFaceRule. | CSSRule | ||
DOM 2 Style IMPORT_RULE : Number = 3
The rule is a CSSImportRule. | CSSRule | ||
DOM 2 Style MEDIA_RULE : Number = 4
The rule is a CSSMediaRule. | CSSRule | ||
DOM 2 Style PAGE_RULE : Number = 6
The rule is a CSSPageRule. | CSSRule | ||
DOM 2 Style STYLE_RULE : Number = 1
The rule is a CSSStyleRule. | CSSRule | ||
DOM 2 Style UNKNOWN_RULE : Number = 0
The rule is a CSSUnknownRule. | CSSRule |
DOM 2 Style cssText | property |
cssText:DOMString
[read-only] Introduced in: | DOM 2 Core |
The parsable textual representation of the rule. This reflects the current state of the rule and not its initial value.
public function get cssText():DOMString
DOMException — SYNTAX_ERR: Raised if the specified CSS string
value has a syntax error and is unparsable.
| |
DOMException — INVALID_MODIFICATION_ERR: Raised if the specified CSS string
value represents a different type of rule than the current one.
| |
DOMException — HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted
at this point in the style sheet.
| |
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.
|
See also
if ( myRule.cssText.indexOf("background-color") != -1 ) { bgRule = myRule; }
DOM 2 Style parentRule | property |
parentRule:CSSRule
[read-only] Introduced in: | DOM 2 Core |
If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns null.
public function get parentRule():CSSRule
See also
DOM 2 Style parentStyleSheet | property |
parentStyleSheet:CSSStyleSheet
[read-only] Introduced in: | DOM 2 Core |
The style sheet that contains this rule.
public function get parentStyleSheet():CSSStyleSheet
See also
if ( bgRule.parentStyleSheet != mySheet ) { // alien style rule! }
DOM 2 Style type | property |
type:Number
[read-only] Introduced in: | DOM 2 Core |
The type of the rule, as defined above.
The expectation is that binding-specific casting methods can be used to cast down from an instance of the CSSRule interface to the specific derived interface implied by the type.
public function get type():Number
See also
DOM 2 Style CHARSET_RULE | Constant |
public const CHARSET_RULE:Number = 2
Introduced in: | DOM 2 Core |
The rule is a CSSCharsetRule.
See also
DOM 2 Style FONT_FACE_RULE | Constant |
public const FONT_FACE_RULE:Number = 5
Introduced in: | DOM 2 Core |
The rule is a CSSFontFaceRule.
See also
DOM 2 Style IMPORT_RULE | Constant |
public const IMPORT_RULE:Number = 3
Introduced in: | DOM 2 Core |
The rule is a CSSImportRule.
See also
DOM 2 Style MEDIA_RULE | Constant |
public const MEDIA_RULE:Number = 4
Introduced in: | DOM 2 Core |
The rule is a CSSMediaRule.
See also
DOM 2 Style PAGE_RULE | Constant |
public const PAGE_RULE:Number = 6
Introduced in: | DOM 2 Core |
The rule is a CSSPageRule.
See also
DOM 2 Style STYLE_RULE | Constant |
public const STYLE_RULE:Number = 1
Introduced in: | DOM 2 Core |
The rule is a CSSStyleRule.
See also
DOM 2 Style UNKNOWN_RULE | Constant |
public const UNKNOWN_RULE:Number = 0
Introduced in: | DOM 2 Core |
The rule is a CSSUnknownRule.
See also