UNPKG

apprun

Version:

JavaScript library that has Elm inspired architecture, event pub-sub and components

20 lines (17 loc) 485 B
import { createElement, updateElement, Fragment } from './vdom-my'; import morphdom from 'morphdom'; export function render(element, html, parent?) { if (typeof html === 'string') { html = html.trim(); if (element.firstChild) { const el = element.cloneNode(false); el.innerHTML = html; morphdom(element, el); } else { element.innerHTML = html; } } else { updateElement(element, html, parent); } } export { createElement, Fragment };