bi-04 step 01 — Build a DOM with correct ordering
Goal
mini-browser M3: a DOM whose mutation algorithms do the work real ones do — before the pointer update, not after.
Tasks
Node,Element,Text,Document; parent/child/sibling links.appendChild,insertBefore,removeChild,removewith the checks the spec requires:- appending a node that already has a parent removes it from the old parent first,
- appending an ancestor into its own descendant throws,
- the hierarchy checks happen before any mutation.
- Attributes, plus a reflected-property layer for at least
classandid. Makeinput.valuediverge from its attribute, deliberately. - Write down, before implementing: how many distinct things
appendChilddoes before it changes a pointer. Then count them after. Most people guess two; the answer is closer to six.
Done when
- All four mutation methods with correct ordering and error cases
- Property/attribute divergence demonstrated for one form control
- Your list of pre-mutation work compared against your prediction