Function findOne

  • findOne(test: ((elem: Element) => boolean), nodes: AnyNode[], recurse?: boolean): Element | null
  • Finds one element in a tree that passes a test.


    The first node that passes test.


    • test: ((elem: Element) => boolean)

      Function to test nodes on.

        • (elem: Element): boolean
        • Parameters

          • elem: Element

          Returns boolean

    • nodes: AnyNode[]

      Node or array of nodes to search.

    • recurse: boolean = true

      Also consider child nodes.

    Returns Element | null