interface Options {
    attr: ((name: string, value: string) => boolean);
    className: ((className: string) => boolean);
    debug?: boolean;
    idName: ((id: string) => boolean);
    maxCandidates: number;
    maxCombinations: number;
    maxDepth?: number;
    optimizedMinLength: number;
    root: Document | Element;
    seedMinLength: number;
    tagName: ((tagName: string) => boolean);
    timeoutMs?: number;
}

Properties

attr: ((name: string, value: string) => boolean)

Function to filter attributes that can be used in the selector. Receives the attribute name and value, returns a boolean.

className: ((className: string) => boolean)

Function to filter class names that can be used in the selector. Receives the class name and returns a boolean.

debug?: boolean

Enable debug logging.

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

Function to filter IDs that can be used in the selector. Receives the ID as a string and returns a boolean.

maxCandidates: number

Maximum number of candidates to consider when generating the selector.

maxCombinations: number

Maximum number of combinations to test.

maxDepth?: number

Maximum depth for DOM traversal. Optional.

optimizedMinLength: number

Minimum length of the path after optimization.

root: Document | Element

The root element from which the selector will be generated. Can be a Document or Element.

seedMinLength: number

Minimum length of the initial path when generating the selector.

tagName: ((tagName: string) => boolean)

Function to filter tag names that can be used in the selector. Receives the tag name and returns a boolean.

timeoutMs?: number

Maximum time in milliseconds to generate the selector before throwing an error. Optional.