• Build an element from the IElement. Use in the browser.

    Parameters

    Returns HTMLElement

    Example

    import { build } from 'deleight/dom'
    // create a template 1:
    const items = it => it.map(num => ({li: num})); // you can abbreviate simple elements

    // create a template 2:
    const footer = year => `<footer>&copy; ${year}</footer>`;

    // use templates:
    const ul = build({
    main: [
    // object form:
    { ul: { 0: { class: 'list1' }, 1: items([1,2,3,4,5,6,7,8,9]) } },

    // text form:
    footer(1991)
    ]

    });

    // reuse a template:
    const ol = build({
    ol: {
    0: { class: 'list2' }, // attributes
    1: items([1,2,3,4,5,6,7,8,9,10]), // children
    2: [ol => ol.onclick = console.log.bind(console)] // components
    }
    });