• Insert the values using the elements as target. The way they are inserted depend on the inserter. If not provided, the default inserter will append the values to the corresponding elements.

    Parameters

    • elements: Iterable<Node>

      The target nodes.

    • values: Iterable<Node>

      The new nodes to insert.

    • Optional insertWith: IInserter

      The insertion function

    Returns [Iterable<Node>, Iterable<Node>]

    Example

    // Insert a span into all the children of the first main element:
    import { insert } from 'deleight/queryoperator';
    const span = document.createElement('span');
    const main = document.querySelector('main');
    insert(main.children, main.children.map(() => span.cloneNode()))