Function createFragment

  • Shorthand for creating a DocumentFragment from markup. If the fragment has only one child, the child is returned instead. So this is also a shorthand for creating single elements.

    Parameters

    • markup: string

      The outerHTML of what to create

    Returns Element | DocumentFragment

    Example

    import { createFragment } from 'deleight/apriori';
    const frag1 = createFragment(`
    <p>Para 1</p>
    <p>Para 2</p>
    `)
    // <p>Para 1</p><p>Para 2</p>