- All Superinterfaces:
CSSRule
- All Known Subinterfaces:
CSSConditionRule
,CSSCounterStyleRule
,CSSDeclarationRule
,CSSFontFaceRule
,CSSFontFeatureValuesRule
,CSSGroupingRule
,CSSKeyframeRule
,CSSKeyframesRule
,CSSMarginRule
,CSSMediaRule
,CSSNamespaceRule
,CSSPageRule
,CSSPropertyRule
,CSSStyleRule
,CSSSupportsRule
- All Known Implementing Classes:
AbstractCSSRule
,BaseCSSDeclarationRule
,CounterStyleRule
,CSSStyleDeclarationRule
,FontFaceRule
,FontFeatureValuesRule
,GroupingRule
,ImportRule
,KeyframeRule
,KeyframesRule
,MarginRule
,MediaRule
,NamespaceRule
,PageRule
,PropertyRule
,StyleRule
,SupportsRule
,UnknownRule
,ViewportRule
A CSS rule.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final short
Rule is aCSSCounterStyleRule
.static final short
static final short
static final short
Rule is aCSSFontFaceRule
.static final short
Rule is aCSSFontFeatureValuesRule
.static final short
Rule is aCSSImportRule
.static final short
Rule is aCSSKeyframeRule
.static final short
Rule is aCSSKeyframesRule
.static final short
Rule is aCSSMarginRule
.static final short
Rule is aCSSMediaRule
.static final short
Rule is aCSSNamespaceRule
.static final short
Rule is aCSSPageRule
.static final short
static final short
static final short
Rule is aCSSStyleRule
.static final short
Rule is aCSSSupportsRule
.static final short
Rule is aCSSUnknownRule
.static final short
Rule is a@viewport
rule.Fields inherited from interface org.w3c.dom.css.CSSRule
CHARSET_RULE
-
Method Summary
Modifier and TypeMethodDescriptionA minified parsable textual representation of the rule.If this rule is contained inside another rule, return that rule.CSSStyleSheet
<? extends CSSRule> Get the style sheet that contains this rule.Get a list of the comments that preceded this rule, if any.Get a list of the comments that immediately follow this rule, if any.void
writeCssText
(SimpleWriter wri, StyleFormattingContext context) Write a serialization of this rule to the given simple writer, according to the given context.Methods inherited from interface org.w3c.dom.css.CSSRule
getCssText, getType, setCssText
-
Field Details
-
UNKNOWN_RULE
static final short UNKNOWN_RULERule is aCSSUnknownRule
.- See Also:
-
STYLE_RULE
static final short STYLE_RULERule is aCSSStyleRule
.- See Also:
-
IMPORT_RULE
static final short IMPORT_RULERule is aCSSImportRule
.- See Also:
-
MEDIA_RULE
static final short MEDIA_RULERule is aCSSMediaRule
.- See Also:
-
FONT_FACE_RULE
static final short FONT_FACE_RULERule is aCSSFontFaceRule
.- See Also:
-
PAGE_RULE
static final short PAGE_RULERule is aCSSPageRule
.- See Also:
-
KEYFRAMES_RULE
static final short KEYFRAMES_RULERule is aCSSKeyframesRule
.- See Also:
-
KEYFRAME_RULE
static final short KEYFRAME_RULERule is aCSSKeyframeRule
.- See Also:
-
MARGIN_RULE
static final short MARGIN_RULERule is aCSSMarginRule
.- See Also:
-
NAMESPACE_RULE
static final short NAMESPACE_RULERule is aCSSNamespaceRule
.- See Also:
-
COUNTER_STYLE_RULE
static final short COUNTER_STYLE_RULERule is aCSSCounterStyleRule
.- See Also:
-
SUPPORTS_RULE
static final short SUPPORTS_RULERule is aCSSSupportsRule
.- See Also:
-
DOCUMENT_RULE
static final short DOCUMENT_RULE- See Also:
-
FONT_FEATURE_VALUES_RULE
static final short FONT_FEATURE_VALUES_RULERule is aCSSFontFeatureValuesRule
.- See Also:
-
VIEWPORT_RULE
static final short VIEWPORT_RULERule is a@viewport
rule.Note:
@viewport
rules were removed by W3C in February 2020.- See Also:
-
REGION_STYLE_RULE
static final short REGION_STYLE_RULE- See Also:
-
CUSTOM_MEDIA_RULE
static final short CUSTOM_MEDIA_RULE- See Also:
-
PROPERTY_RULE
static final short PROPERTY_RULE- See Also:
-
-
Method Details
-
getMinifiedCssText
String getMinifiedCssText()A minified parsable textual representation of the rule. This reflects the current state of the rule and not its initial value.- Returns:
- the minified textual representation of the rule.
-
getParentRule
CSSRule getParentRule()If this rule is contained inside another rule, return that rule. If it is not nested inside any other rules, returnnull
.- Specified by:
getParentRule
in interfaceCSSRule
- Returns:
- the containing rule, if any, otherwise
null
.
-
getParentStyleSheet
CSSStyleSheet<? extends CSSRule> getParentStyleSheet()Get the style sheet that contains this rule.- Specified by:
getParentStyleSheet
in interfaceCSSRule
- Returns:
- the style sheet, or null if no sheet contains this rule.
-
getPrecedingComments
StringList getPrecedingComments()Get a list of the comments that preceded this rule, if any.- Returns:
- the list of comments, or
null
if there were no preceding comments or the parsing was specified to ignore comments. - See Also:
-
getTrailingComments
StringList getTrailingComments()Get a list of the comments that immediately follow this rule, if any.If the parsing mode was
COMMENTS_PRECEDING
, or wasCOMMENTS_AUTO
and the next comment happens after a newline character, it shall be assigned to the next rule as a preceding comment.- Returns:
- the list of comments, or
null
if there were no trailing comments or the parsing was specified to ignore comments. - See Also:
-
writeCssText
Write a serialization of this rule to the given simple writer, according to the given context.- Parameters:
wri
- the simple writer object.context
- the formatting context.- Throws:
IOException
- if an error happened while writing.
-