fw-02 step 01 — Elements, mounting, reconciliation
Goal
Get spec stages 1–3 green, including the DOM-operation budget that is the virtual DOM's entire value proposition.
Tasks
createElement(type, props, ...children)returning plain data. Writeh('div', {id:'x'}, 'hi')by hand and look at the object.render(element, container)— mount only, no diffing. ExportsetDocument(doc)so the spec can inject the instrumented fake DOM.- Reconciliation: same type reuses the node in place; different type replaces.
- The budget test. Changing one item in a 200-item list must cost ≤5 DOM operations. If you fail this you are rebuilding, not reconciling.
- Run the same scenario with
innerHTMLreplacement and count operations. That number is the right-hand side of the virtual DOM's inequality.
Done when
- Stages 1–3 green
- Op counts recorded for reconcile vs innerHTML replacement
-
keyis not rendered as a DOM attribute