UNPKG

marko

Version:

UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.

35 lines (28 loc) 920 B
var ComponentsContext = require("../../../runtime/components/ComponentsContext"); var getComponentsContext = ComponentsContext.___getComponentsContext; module.exports = function render(input, out) { var isComponent = !input.n; var shouldPreserve = !("i" in input) || input.i; var componentsContext = out.___components; if (isComponent) { out.bf(out.___assignedKey, out.___assignedComponentDef.___component, true); } if (input.renderBody) { if (shouldPreserve) { var parentPreserved = false; if (componentsContext) { parentPreserved = componentsContext.___isPreserved; } else { componentsContext = getComponentsContext(out); } componentsContext.___isPreserved = true; input.renderBody(out); componentsContext.___isPreserved = parentPreserved; } else { input.renderBody(out); } } if (isComponent) { out.ef(); } };