UNPKG

pop

Version:

Pop is a [Hyperapp](https://github.com/hyperapp/hyperapp) / [Ultradom](https://github.com/ultradom/ultradom) spin-off project — yet another micro-framework for creating graphical user interfaces. This is not the final title, but let's go with that for now

24 lines (18 loc) 550 B
import { recycleElement } from "./recycleElement" import { patchElement } from "./patchElement" export function patch(node, element) { var lifecycle = [] element = element ? patchElement( element.parentNode, element, element.node == null ? recycleElement(element, [].map) : element.node, node, lifecycle, element.node == null // isRecycling ) : patchElement(null, null, null, node, lifecycle) element.node = node while (lifecycle.length) lifecycle.pop()() return element }