A CSSRuleList
represents an ordered collection of read-only CSSRule
objects.
While the CSSRuleList
object is read-only, and cannot be directly modified, it is considered a live
object, as the content can change over time.
To edit the underlying rules returned by CSSRule
objects, use CSSStyleSheet.insertRule()
and CSSStyleSheet.deleteRule()
, which are methods of CSSStyleSheet
.
The interface has no constructor. An instance of CSSRuleList
is returned by CSSStyleSheet.cssRules
and CSSKeyframesRule.cssRules
.
Note: This interface was an attempt to create an unmodifiable list and only continues to be supported to not break code that's already using it. Modern APIs use types that wrap around ECMAScript array types instead, so you can treat them like ECMAScript arrays, and at the same time impose additional semantics on their usage (such as making their items read-only).