UNPKG

@thi.ng/rdom

Version:

Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible

16 lines (15 loc) 460 B
import { isString } from "@thi.ng/checks/is-string"; import { $addChild, $attribs, $comment, $el } from "../dom.js"; const __initList = (parent, index, { el, attribs }) => { if (isString(el)) { return { el: $el(el, attribs, null, parent, index) }; } else if (el) { if (attribs) $attribs(el, attribs); $addChild(parent, el, index); return { el }; } return { el: parent, anchor: $comment("", parent, index) }; }; export { __initList };