MCPcopy
hub / github.com/d3/d3 / toHyperScript

Function toHyperScript

docs/components/PlotRender.js:123–130  ·  docs/components/PlotRender.js::toHyperScript
(node)

Source from the content-addressed store, hash-verified

121
122class="cm">// Converts the real DOM to virtual DOM (for client-side hydration).
123function toHyperScript(node) {
124 if (node.nodeType === 3) return node.nodeValue; class="cm">// TextNode
125 const props = {};
126 for (const name of node.getAttributeNames()) props[name] = node.getAttribute(name);
127 const children = [];
128 for (let child = node.firstChild; child; child = child.nextSibling) children.push(toHyperScript(child));
129 return h(node.tagName, props, children);
130}
131
132export default {
133 props: {

Callers 1

renderFunction · 0.85

Calls 1

getAttributeMethod · 0.80

Tested by

no test coverage detected