@laserware/dominator
    Preparing search index...

    Function removeCssVar

    • Removes the CSS variable name from the optionally specified target.

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

      Type Parameters

      Parameters

      • name: `--${string}`

        Name of the CSS variable to remove.

      • Optionaltarget: null | Target = document.documentElement

        Optional Element, EventTarget, or CSS selector.

      Returns E

      Element representation of the specified target.

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

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

      HTML (Before)

      <style>:root { --color-fg: green; --is-small: false }</style>

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

      Remove from Element

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

      removeCssVar("color-bg", element);

      Remove from :root

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

      removeCssVar("color-fg");

      HTML (After)

      <style>:root { --is-small: false }</style>

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