Function selectMembers

  • Sets the selected members as properties on the element using the keys associated with the selectorAttr.

    Type Parameters

    • T extends object

    Parameters

    • Optional element: Element
    • selectorAttr: string = 'm-ember'

    Returns Element & T

    Example

    import { selectMembers } from 'deleight/dom/components'
    import { apply } from 'deleight/dom/apply'

    document.body.innerHTML = `
    <div>I am a div</div>
    <p>I am a paragraph</p>
    <section>I am a section <button m-ember="b1">Btn1</button></section>
    <article>I am an article <button m-ember="b2">Btn2</button></article>
    `;

    selectMembers();
    document.body.b1;
    document.body.b2;