Function $wrapEl

rdom: IComponent wrapper for an existing DOM element. When mounted, the given element will be (re)attached to the parent node provided at that time. docs

# Example

import { $compile, $wrapEl } from 'https://esm.run/@thi.ng/rdom'; const title = document.createElement("h1"); title.innerText = "hello"; // embed existing DOM element inside an rdom tree $compile(["div", {}, $wrapEl(title), "world..."]).mount(document.body);

# Application Frame

//wiki.ralfbarkow.ch/assets/pages/snippet-template/esm.html

See:

mount : Async component lifecycle method to initialize & attach the component in the target DOM.

The index arg is used to define the child index of where to mount the component in the parent element and SHOULD default to -1, causing the component to be appended to (rather than inserted into) the list of children. The index arg MUST be passed to any DOM creation functions used within mount() (e.g. $el, $tree). Likewise, for control-flow or wrapper components, the index arg MUST be used when mounting child components in-place of the wrapper component itself (e.g. see $list, $klist, $sub etc.)