dist/main.html
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>JS Bin</title></head><body><script src="./main.js"></script></body></html>
// 实现解析jsx
window.a = <div id="app" class="head"><span>1</span><span>2</span><span><h1>3</h1><h1>4</h1></span>hello</div>document.body.appendChild(window.a)function createElement(tagName, attributes, ...rest) {let elementelement = document.createElement(tagName)if (typeof attributes === 'object' && attributes instanceof Object) {for (const key in attributes) {element.setAttribute(key, attributes[key])}}for(const child of rest) {if (typeof child == 'string') {child = document.createTextNode(child)}element.appendChild(child)}return element}
