UNPKG

@virtualstate/examples

Version:
26 lines 698 B
import { Instance } from "@virtualstate/fringe"; import { proxyProperties } from "./proxy.js"; export function proxyDocumentInstance(node) { const source = node.source; if (typeof source !== "string") { return node; } let element; return proxyProperties(node, { [Instance]: get }); function get() { if (typeof source !== "string") { throw new Error("Unexpected source"); } if (element) { return element; } const options = { ...node.options }; element = document.createElement(source, options); return element; } } //# sourceMappingURL=document.js.map