7. remove-rule
| Chapter 3. Commands which are specific to w2x |

## 7. remove-rule

    remove-rule(selector?)

Remove “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.

Argument `selector` the CSS rule specifies which should be removed. Defaults to the empty string "", which means: remove all CSS rules.

- `selector` may be the empty string "", which means: remove 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 removes all rules having selectors matching specified pattern.

  A selector pattern has the following syntax: `/`pattern`/` or `^`pattern`$` (which is equivalent to `/^`pattern`$/`), where `pattern` is a regular expression pattern.

Examples:

    (: Remove all rules. :)
    remove-rule();

    (: Remove rule #0. :)
    remove-rule(0);

    (: Remove rule "p". :)
    remove-rule("p");

    (: Remove all rules matching "/n-\d+/". :)
    remove-rule("/n-\d+/");

See also `add-rule`, `set-rule`.

Related XPath extension functions: `find-rule`, `get-rule`.

6. remove-class |  | 8. set-rule