• Returns an HTML builder which can be used to create HTMLElement instances (with build method) or their text representations (with render method).

    Type Parameters

    • T extends "object" | "search" | "link" | "small" | "sub" | "sup" | "map" | "input" | "base" | "time" | "code" | "data" | "progress" | "track" | "source" | "button" | "address" | "a" | "abbr" | "area" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "canvas" | "caption" | "cite" | "col" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr"

    Parameters

    Returns HTMLElementBuilder<T>

    Example

    import { html, h } from 'deleight/dom/builder'
    // const verboseBuilder = html('main').set({ class: 'right bg' }).append(9);
    const builder = h.main.set({ class: 'right bg' }).append(9);

    const markup = builder.render();
    console.log(markup === `
    <main class="right bg">
    9
    </main>
    `); // true

    const element = builder.build();
    console.log(element.tagName); // MAIN