addRule

suspend fun addRule(args: CSS.AddRuleParameter, mode: CommandMode = CommandMode.DEFAULT): CSS.AddRuleReturn

Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the position specified by location.


suspend fun addRule(styleSheetId: String, ruleText: String, location: CSS.SourceRange, nodeForPropertySyntaxValidation: Int? = null): CSS.AddRuleReturn

Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the position specified by location.

Parameters

styleSheetId

The css style sheet identifier where a new rule should be inserted.

ruleText

The text of a new rule.

location

Text position of a new rule in the target style sheet.

nodeForPropertySyntaxValidation

NodeId for the DOM node in whose context custom property declarations for registered properties should be validated. If omitted, declarations in the new rule text can only be validated statically, which may produce incorrect results if the declaration contains a var() for example.