• Query the DOM for an element matching the specified CSS selector in the optionally specified parent.

    Type Parameters

    Parameters

    • selector: string

      CSS selector string to find the element.

    • Optionalparent: null | ElementLike

      Optional Element or EventTarget for parent.

    Returns null | E

    Element of type E if found, otherwise null.

    SyntaxError if the specified selector is invalid.

  • Query the DOM to find the element using one of the specified options in the optionally specified parent.

    Type Parameters

    Parameters

    • options: FindOptions

      Options for finding the element.

      • Optionalparent?: Target | null

        Optional parent Element, EventTarget, or CSS selector.

      • OptionaltagName?: TagName | string

        Optional element tag name to limit search.

      • OptionalwithAttributes?: Attributes<E> | AttributeName[] | AttributeName

        Key/value pairs of attributes to search for.

      • OptionalwithDataset?: Dataset | DatasetKey[] | DatasetKey

        Key/value pairs of dataset entries to search for.

      • OptionalwithSelector?: CssSelector

        CSS selector search string.

    Returns null | E

    Element of type E if found, otherwise null.

    SyntaxError if withSelector in the specified options is invalid.

    TypeError if the specified options are invalid.