Skip to content

Fix lazy media in-viewport tests to check loadeddata instead of loadsstart - #58405

Merged
zcorpan merged 1 commit into
web-platform-tests:masterfrom
Squarespace:fix-lazy-media-in-viewport-tests
Mar 23, 2026
Merged

zcorpan merged 1 commit into
web-platform-tests:masterfrom
Squarespace:fix-lazy-media-in-viewport-tests

Conversation

@scottjehl

Copy link
Copy Markdown
Contributor

The loadstart event has no ordering guarantee relative to the window load event. Intersection observer callbacks can fire before or after the load event, and media elements use their own task source, so loadstart may be dispatched before window load.

The trickle(d2) pipe ensures slow media delivery, so checking loadeddata (which fires after enough data arrives to render the first frame) reliably verifies that window onload is not blocked by lazy media elements.

@zcorpan

zcorpan commented Mar 23, 2026

Copy link
Copy Markdown
Member

This now needs a rebase :)

…tart

The loadstart event has no ordering guarantee relative to the window
load event. Intersection observer callbacks can fire before or after
the load event, and media elements use their own task source, so
loadstart may be dispatched before window load.

The trickle(d2) pipe ensures slow media delivery, so checking
loadeddata (which fires after enough data arrives to render the first
frame) reliably verifies that window onload is not blocked by lazy
media elements.
@scottjehl
scottjehl force-pushed the fix-lazy-media-in-viewport-tests branch from ec22a2c to d089c93 Compare March 23, 2026 21:02
@scottjehl

Copy link
Copy Markdown
Contributor Author

@zcorpan rebased! Thanks

@zcorpan
zcorpan merged commit 38abe5a into web-platform-tests:master Mar 23, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants