Available since v0.1.0

fs-trigger="unmount"

Stable

Fires when the element is removed from the DOM. Use for cleanup validation — verify that removing a feature also removes its side effects.

Syntax

<div class="modal"
  fs-assert="modal/unmount-cleanup"
  fs-trigger="unmount"
  fs-assert-removed=".backdrop">
</div>

When to use it

  • Cleanup validation when a section is torn down (modals, drawers, lazy-loaded pages)
  • "When X disappears, Y should also disappear" contracts

Example

<div id="editor-panel"
  fs-assert="editor/unmount-saves-draft"
  fs-trigger="unmount"
  fs-assert-added=".draft-saved-toast">
</div>

When the editor panel is removed, assert that a "draft saved" toast appears elsewhere.

Pairs well with

Gotchas

  • Timing. The assertion is created at the moment of removal. If the side effect happens in the same microtask, use OOB with fs-assert-oob-fail or a different trigger — unmount is a commit moment, not a window.
  • Full page unloads don't fire unmount. The agent's unload grace-period model takes over (see timeout).

See also