v156 · dom · feature removal
Navigation, moves & focus
The change is narrow, and the edges are where code goes wrong. A subframe that navigates still fires all three events — only removal changes. moveBefore() never fired anything because it never destroys the frame. And the blur/focusout a focused field might get on removal is a different flag entirely.
--enable-blink-features=OmitSubframeDetachmentEventsOnRemoval (Chrome 156+). The focus experiment’s neighbouring change is
--enable-blink-features=OmitBlurEventOnElementRemoval — also status "test", and not part of this ChromeStatus entry.
1 · Navigate, then remove
Loads a same-origin frame, navigates it to a second document (srcdoc change), then removes the second document. Expected with the flag on: events in step 1, none in step 2.
2 · moveBefore() vs insertBefore()
The frame counts its own lifetime ticks. Moving it with moveBefore() keeps the document alive; moving it with insertBefore() is a remove-then-insert: the old document is destroyed (firing the removal events on legacy Chrome) and a fresh one loads.
box A
box B
Loading the frame…
3 · Remove a frame that holds focus
Focuses a text field inside a same-origin frame, then removes the frame. Records blur/focusout on the field, blur on its window, and the detachment events — and where focus lands in the parent afterwards.
Not run yet.
the code
// Navigation is NOT removal — these still fire (spec: "unload a document")
frame.srcdoc = "<p>next</p>"; // pagehide(persisted=false), visibilitychange, unload
// Removal — omitted with the flag on (spec: "destroy a child navigable")
frame.remove();
// A move that is not a removal at all
if ("moveBefore" in Element.prototype) boxB.moveBefore(frame, null); // no teardown, no reload
else boxB.insertBefore(frame, null); // remove + insert: destroys and reloads the frame
Ground truth while building (Chrome for Testing 153, headless): navigation fired pagehide with persisted=false; moveBefore() fired nothing and caused no reload, insertBefore() fired pagehide and reloaded the frame; removing a focused frame fired pagehide but no blur/focusout in that headless session (focus behaviour depends on whether the window itself has system focus).