CSSStyleSheet extension type
The CSSStyleSheet
interface represents a single
CSS stylesheet, and lets
you inspect and modify the list of rules contained in the stylesheet. It
inherits properties and methods from its parent, StyleSheet.
A stylesheet consists of a collection of CSSRule objects representing each of the rules in the stylesheet. The rules are contained in a CSSRuleList, which can be obtained from the stylesheet's CSSStyleSheet.cssRules property.
For example, one rule might be a CSSStyleRule object containing a style such as:
h1,
h2 {
font-size: 16pt;
}
Another rule might be an at-rule such as or , and so forth.
See the Obtaining a StyleSheet section for the
various ways a CSSStyleSheet
object can be obtained. A CSSStyleSheet
object can also be directly constructed. The constructor, and the
CSSStyleSheet.replace, and CSSStyleSheet.replaceSync methods are newer
additions to the specification, enabling Constructable Stylesheets.
- on
- Implemented types
Constructors
- CSSStyleSheet([CSSStyleSheetInit options])
-
factory
Properties
- cssRules → CSSRuleList
-
no setter
- disabled ↔ bool
-
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- href → String?
-
no setterinherited
- media → MediaList
-
no setterinherited
- ownerNode → JSObject?
-
no setterinherited
- ownerRule → CSSRule?
-
no setter
- parentStyleSheet → CSSStyleSheet?
-
no setterinherited
- rules → CSSRuleList
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → String?
-
no setterinherited
- type → String
-
no setterinherited
Methods
-
addRule(
[String selector, String style, int index]) → int -
The obsolete CSSStyleSheet interface's
addRule()
legacy method adds a new rule to the stylesheet. You should avoid using this method, and should instead use the more standard CSSStyleSheet.insertRule method. -
deleteRule(
int index) → void -
The CSSStyleSheet method
deleteRule()
removes a rule from the stylesheet object. -
insertRule(
String rule, [int index]) → int -
The
CSSStyleSheet.insertRule()
method inserts a new CSS rule into the current style sheet. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeRule(
[int index]) → void -
The obsolete CSSStyleSheet method
removeRule()
removes a rule from the stylesheet object. It is functionally identical to the standard, preferred method CSSStyleSheet.deleteRule. -
replace(
String text) → JSPromise< CSSStyleSheet> -
The
replace()
method of the CSSStyleSheet interface asynchronously replaces the content of the stylesheet with the content passed into it. The method returns a promise that resolves with theCSSStyleSheet
object. -
replaceSync(
String text) → void -
The
replaceSync()
method of the CSSStyleSheet interface synchronously replaces the content of the stylesheet with the content passed into it. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited