• Query the DOM to find the elements matching the specified CSS selector in the optionally specified parent.

    Type Parameters

    • TN extends TagName = "*"

      Tag name of elements to return.

    Parameters

    • selector: string

      CSS selector string to find the elements.

    • Optionalparent: null | ElementLike

      Optional Element or EventTarget for parent.

    Returns ElementOf<TN>[]

    Array of elements of tag name TN if found, otherwise empty array.

    SyntaxError if the specified selector is invalid.

  • Query the DOM using one of the specified options and find the elements that match the criteria in the options object in the optionally specified parent.

    Type Parameters

    • TN extends TagName = "*"

      Tag name of elements to return.

    Parameters

    Returns ElementOf<TN>[]

    Array of elements of tag name TN if found, otherwise empty array.

    SyntaxError if withSelector in the specified options is invalid.

    TypeError if the specified options are invalid.