Available since v0.1.0

fs-trigger="load"

Stable

Fires on the native load event of media elements. Use for image, video, or iframe load validation.

Syntax

<img src="/hero.webp"
  fs-assert="home/hero-loaded"
  fs-trigger="load"
  fs-assert-loaded="img.hero">

When to use it

  • Hero image load validation
  • Video or iframe loaded-successfully contracts
  • Anything where "did the resource actually fetch?" is a visible correctness signal

Example

<video src="/demo.mp4" controls
  fs-assert="demo/video-loaded"
  fs-trigger="load"
  fs-assert-loaded="video">
</video>

Pairs well with

Gotchas

  • Cached resources. Browsers fire load synchronously for cached resources. If the image is in cache when the agent initializes, the event may fire before the assertion is registered. Prefer fs-assert-loaded which also checks .complete for the cached case.
  • iframe load is noisy. Every navigation inside the iframe fires another load. Scope the assertion key appropriately.

See also