| 121 | |
| 122 | class="cm">// Converts the real DOM to virtual DOM (for client-side hydration). |
| 123 | function 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 | |
| 132 | export default { |
| 133 | props: { |