v133 · dom
DOM State-Preserving Move
This features adds a DOM primitive (moveBefore) that allows moving elements around a DOM tree, without resetting the element's state. This function would be available on ParentNodes, like Element, Document, DocumentFragment.
concepts
-
Element.moveBefore()
Element.moveBefore() relocates a node WITHOUT reinitialising iframes, restarting animations, or losing focus. The reparent operation we've all needed.
-
Iframe no-reload
Move an
<iframe>between two slots withappendChildvsmoveBefore. The load counter and CSS animation iterations make the state preservation visible. -
Audio keepalive
A playing
<audio>reparented between mini-player and full-player slots.appendChildresets time;moveBeforekeeps the pipeline alive. -
Focus & selection
The drag-and-drop builder problem: relocate an editing card without dropping focus or losing the user's text selection.
moveBeforepreserves both. -
Animation continuity
Three CSS animations — a spinning orb, a sweep bar, and a colour gradient — run on a card that you move between slots.
moveBeforekeeps every animation at its current timeline position;appendChildresets them all to iteration zero.
why it shipped
This features adds a DOM primitive (moveBefore) that allows moving elements around a DOM tree, without resetting the element's state. This function would be available on ParentNodes, like Element, Document, DocumentFragment.