Glossary Term
CSSStyleSheet.insertRule()
The CSSStyleSheet.insertRule() method inserts a new CSS rule into the current style sheet.
Note: Although insertRule() is exclusively a method of CSSStyleSheet, it actually inserts the rule into CSSStyleSheet.cssRules — its internal CSSRuleList.
Inputs: rule A string containing the rule to be inserted. What the inserted rule must contain depends on its type: For rule-sets, both a selector and a style declaration. For at-rules, both an at-identifier and the rule content.
Returns: The newly inserted rule’s index within the stylesheet’s rule-list.
Exceptions: IndexSizeError DOMException Thrown if index > CSSRuleList.length. HierarchyRequestError DOMException Thrown if rule cannot be inserted at the specified index due to some CSS constraint; for instance: trying to insert an @import at-rule after a style rule. SyntaxError DOMException Thrown if more than one rule is given in the rule parameter. InvalidStateError DOMException Thrown if rule is @namespace and the rule-list contains at-rules other than @import and @namespace at-rules.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
