The DOM is stupid. It has appendChild
and insertBefore
, but no prependChild
and insertAfter
.
So we should just walk the DOM back to front.
We will deal with fragments. A Fragment can contain a variable number of nodes, 0 or more.
seq()
creates a fragment with 0 or more nodesmatch()
creates a fragment with 0 or 1 nodechildren
creates a fragment with 0 or more nodes