@juulsgaard/ts-tools
    Preparing search index...

    Class ElementClassManager<T>

    A class to manage the applied classes on an HTML Element. The class keeps track of what classes were added and can use that to create differentials.

    Type Parameters

    • T extends HTMLElement = HTMLElement
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    element: T

    Accessors

    Methods

    • Toggle classes from the HTML Element.

      Parameters

      • classes: Record<string, boolean>

        The classes and their toggle state

      Returns { added: string[]; removed: string[] }

      affectedClasses - lists of classes that were added / removed from the state

    • Toggle classes from the HTML Element.

      Parameters

      • classes: string | string[] | null | undefined

        The classes to remove

      • Optionalstate: boolean

        Force the state of classes

      Returns { added: string[]; removed: string[] }

      affectedClasses - lists of classes that were added / removed from the state