set-rule(selector,property-name,property-value?)
Add, replace or remove property property-name to/from “interned” CSS rule having selector selector.
For this command to work, command parse-styles must have been invoked in order to “intern” the CSS classes found in all the elements of the document being edited.
selectorSpecifies the CSS rule which should be modified.
selector may be the empty string "", which means all CSS rules.
selector may be the index of a CSS rule (possibly in string form) within the document being edited. First index is 0. Examples: 0, "43".
selector may be a selector. Examples: "p", ".c-Code".
selector may be a selector pattern. Examples: "^\.c-.+$", "/n-\d+/". This command modifies all rules having selectors matching specified pattern.
A selector pattern has the following syntax: / or pattern/^ (which is equivalent to pattern$/^), where pattern$/pattern is a regular expression pattern.
property-nameSpecifies the name of the property which should be added, replaced or removed. The empty string "" means: remove or replace all properties from/in the CSS rule.
property-valueSpecifies the value of the property which should be added, replaced or removed. Defaults to the empty string "", which means: remove property property-name from the CSS rule.
Moreover, when property-name is "" (which means: all properties), property-value may be a list of name:value pairs separated by ";".
Examples:
(: Remove property "line-height" from all rules. :)
set-rule("", "line-height");
(: Remove all properties from rule #0. :)
set-rule(0, "");
(: Replace all the properties in rule "p". :)
set-rule("p", "", "text-align: justify; line-height: 1.2;");
(: Add or replace property "color" in rule ".c-Code". :)
set-rule(".c-Code", "color", "#808080");
(: Remove property "font-family" from all rules having
selectors matching "^\.c-.+$". :)
set-rule("^\.c-.+$", "font-family");See also add-rule, remove-rule.