Function attrsSetter

  • Returns a component for setting multiple element attributes.

    Pending tests. Please report bugs.

    Type Parameters

    • T extends object

    Parameters

    • values: T

    Returns ((elements) => void)

      • (elements): void
      • Parameters

        • elements: Element | Iterable<Element>

        Returns void

    Example

    import { attrsSetter } 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>Btn1</button></section>
    <article>I am an article <button>Btn2</button></article>
    `;

    apply({
    section: { button: attrsSetter({ a: '1', b: '2' }) },
    article: { button: attrsSetter({ a: '5', b: '6' }) }
    });