@laserware/dominator
    Preparing search index...

    Function removeCssVars

    • Removes the CSS variables with names from the optionally specified target.

      If no target is specified, uses documentElement (i.e. :root).

      Type Parameters

      Parameters

      • names: `--${string}`[]

        Array of CSS variable names to remove.

      • Optionaltarget: null | Target = document.documentElement

        Optional Element, EventTarget, or CSS selector.

      Returns E

      Element representation of the specified target.

      InvalidCssVarError if a CSS variable could not be removed from target.

      elements!InvalidElementError if the specified target wasn't found.

      HTML (Before)

      <style>
      :root {
      --color-fg: green;
      --padding-small: "24px";
      --is-small: true;
      }
      </style>

      <button id="example" style="--color-bg: blue; --is-big: true; font-size: 18px;">
      Example
      </button>

      Remove from Element

      const element = findElement("#example")!;

      removeCssVars(["--color-bg", "--is-big"] , element);

      Remove from :root

      removeCssVars(["--color-fg", "--padding-small"]);
      

      HTML (After)

      <style>
      :root {
      --is-small: true;
      }
      </style>

      <button id="example" style="font-size: 18px;">
      Example
      </button>