Strategy for generating CSS selectors based on the ID of an element.

Implements

Constructors

Methods

Constructors

  • Creates an instance of IdStrategy.

    Parameters

    • options: {
          idName: ((id: string) => boolean);
      }

      Configuration options for the strategy.

      • idName: ((id: string) => boolean)

        A function to validate the ID name.

          • (id): boolean
          • Parameters

            • id: string

            Returns boolean

    Returns IdStrategy

Methods

  • Generates a CSS selector part for the given element based on its ID.

    Parameters

    • element: Element

      The DOM element for which to generate the selector.

    Returns null | SelectorPart

    A SelectorPart object containing the selector name and penalty, or null if no valid ID is found.