Skip to content

Web Platform Tests for HTML video and audio element lazy loading via the loading attribute#57051

Merged
keithamus merged 39 commits intoweb-platform-tests:masterfrom
Squarespace:video-loading-attr
Feb 12, 2026
Merged

Web Platform Tests for HTML video and audio element lazy loading via the loading attribute#57051
keithamus merged 39 commits intoweb-platform-tests:masterfrom
Squarespace:video-loading-attr

Conversation

@scottjehl
Copy link
Contributor

@scottjehl scottjehl commented Jan 7, 2026

These tests support the proposal for the addition of a loading attribute
on the video and audio elements, designed to enable lazy-loading of resources related to those elements.

Related HTML Standard Proposal: whatwg/html#11980
Related issue: whatwg/html#10376

These are designed to pass in a browser that supports the proposed feature (verified in a locally patched browser).

Co-authored-by: Zach Lysobey zlysobey@squarespace.com
Co-authored-by: Brad Frost bfrost@squarespace.com
Co-authored-by: Credo Duarte cduarte@squarespace.com

…g attribute

These tests support the proposal for the addition of a loading attribute
on the video element, designed to enable lazy-loading for video and poster
data. HTML Standard PR here whatwg/html#11980

Co-authored-by: Zach Lysobey <zlysobey@squarespace.com>
Co-authored-by: Brad Frost <bfrost@squarespace.com>
Co-authored-by: Credo Duarte <cduarte@squarespace.com>
scottjehl and others added 2 commits January 8, 2026 10:24
rename files to use a .tentative.html convention since they correspond with a proposed HTML feature
@scottjehl
Copy link
Contributor Author

Renamed the files to be .tentative.html since they correspond with a proposed HTML feature. Thanks for the tip @keithamus

@scottjehl scottjehl requested a review from zcorpan January 14, 2026 23:45
@scottjehl
Copy link
Contributor Author

Thanks for the review.
After latest revisions:

  • Re-verified these tests fail in existing stable browsers (aside from visibility-deferred autoplay tests in browsers that support that already).
  • Re-verified these are all passing in our local patched webkit and firefox (for whatever that's worth).

@scottjehl scottjehl requested a review from zcorpan February 5, 2026 12:26
@scottjehl
Copy link
Contributor Author

I just added some tests to round out the suite a bit (disconnected node, missing controls attribute, non-rendered elements), and the reflection tests are tentative again so they can be considered for merge before the spec

https://github.com/web-platform-tests/wpt/pull/57051/changes/2283368b8484740e0f2925fd1b034067fc9bcd80..9f8574c45a83547ecef49ff478a62a36fb01bd09

@hjanuschka
Copy link
Contributor

is there a ETA when this PR can land? on chromium side we are almost done with review (and potentially landing it behind a flag), but would be great to have tests landed first, rn i have them commited into my chromium cl (to see if they turn green), landing it would most likely send a WPT bot and might mess it up.

Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given these are all tentative, and there's no obvious issues (racey conditions). In addition the major feedback from @zcorpan has been addressed, I think we should merge this in.

@keithamus keithamus merged commit cb58273 into web-platform-tests:master Feb 12, 2026
26 checks passed
@keithamus
Copy link
Member

@scottjehl for next steps, please raise a PR which renames these from tentative to not (so .tentative.html becomes .html), please also uncomment the changesi n elements-embedded. Raise this as a PR and attach it to the HTML spec PR, that way we can make these tests official as the spec PR lands.

@scottjehl
Copy link
Contributor Author

Thanks @keithamus !
That PR is up: #57754

credod added a commit to Squarespace/WebKit that referenced this pull request Feb 12, 2026
…ttribute

https://bugs.webkit.org/show_bug.cgi?id=303995

Reviewed by NOBODY (OOPS!).

Implement proposed loading attribute for video and audio elements.
This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay.

This change is proposed to be added to the HTML spec in the following PR:
whatwg/html#11980

This patch is passing video and audio WPT tests from the following PR:
web-platform-tests/wpt#57051

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::lazyLoadMediaObserver):
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):
(WebCore::HTMLMediaElement::attributeChanged):
(WebCore::HTMLMediaElement::didFinishInsertingNode):
(WebCore::HTMLMediaElement::removedFromAncestor):
(WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue):
(WebCore::HTMLMediaElement::isLazyLoadable const):
(WebCore::HTMLMediaElement::loadDeferredMedia):
(WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded):
(WebCore::HTMLMediaElement::loading const):
(WebCore::HTMLMediaElement::setLoading):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::sourceWasAdded):
(WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::rendererIsNeeded):
(WebCore::HTMLVideoElement::supportsFullscreen const):
(WebCore::HTMLVideoElement::hasAvailableVideoFrame const):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::loadDeferredMedia):
* Source/WebCore/html/HTMLVideoElement.h:
* Source/WebCore/html/LazyLoadMediaObserver.cpp: Added.
(WebCore::LazyLoadMediaObserver::observe):
(WebCore::LazyLoadMediaObserver::unobserve):
(WebCore::LazyLoadMediaObserver::intersectionObserver):
(WebCore::LazyLoadMediaObserver::isObserved const):
* Source/WebCore/html/LazyLoadMediaObserver.h: Added.
* Source/WebCore/html/parser/HTMLParserOptions.cpp:
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* Source/WebCore/html/shadow/DataListButtonElement.cpp:
* Source/WebCore/html/shadow/SpinButtonElement.cpp:
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::didUpdateCachedImage):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::updatedHasPendingEvent):
(WebCore::ImageLoader::decode):
controls: "boolean",
controlsList: {type: "tokenlist", domAttrName: "controlsList"},
defaultMuted: {type: "boolean", domAttrName: "muted"},
defaultMuted: {type: "boolean", domAttrName: "muted"}/*,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a syntax error.
It needs a comma between this property and the next property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

credod added a commit to Squarespace/WebKit that referenced this pull request Feb 17, 2026
…ttribute

https://bugs.webkit.org/show_bug.cgi?id=303995

Reviewed by NOBODY (OOPS!).

Implement proposed loading attribute for video and audio elements.
This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay.

This change is proposed to be added to the HTML spec in the following PR:
whatwg/html#11980

This patch is passing video and audio WPT tests from the following PR:
web-platform-tests/wpt#57051

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::lazyLoadMediaObserver):
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):
(WebCore::HTMLMediaElement::attributeChanged):
(WebCore::HTMLMediaElement::didFinishInsertingNode):
(WebCore::HTMLMediaElement::removedFromAncestor):
(WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue):
(WebCore::HTMLMediaElement::isLazyLoadable const):
(WebCore::HTMLMediaElement::loadDeferredMedia):
(WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded):
(WebCore::HTMLMediaElement::loading const):
(WebCore::HTMLMediaElement::setLoading):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::sourceWasAdded):
(WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::rendererIsNeeded):
(WebCore::HTMLVideoElement::supportsFullscreen const):
(WebCore::HTMLVideoElement::hasAvailableVideoFrame const):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::loadDeferredMedia):
* Source/WebCore/html/HTMLVideoElement.h:
* Source/WebCore/html/LazyLoadMediaObserver.cpp: Added.
(WebCore::LazyLoadMediaObserver::observe):
(WebCore::LazyLoadMediaObserver::unobserve):
(WebCore::LazyLoadMediaObserver::intersectionObserver):
(WebCore::LazyLoadMediaObserver::isObserved const):
* Source/WebCore/html/LazyLoadMediaObserver.h: Added.
* Source/WebCore/html/parser/HTMLParserOptions.cpp:
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* Source/WebCore/html/shadow/DataListButtonElement.cpp:
* Source/WebCore/html/shadow/SpinButtonElement.cpp:
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::didUpdateCachedImage):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::updatedHasPendingEvent):
(WebCore::ImageLoader::decode):
credod added a commit to Squarespace/WebKit that referenced this pull request Feb 18, 2026
…ttribute

https://bugs.webkit.org/show_bug.cgi?id=303995

Reviewed by NOBODY (OOPS!).

Implement proposed loading attribute for video and audio elements.
This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay.

This change is proposed to be added to the HTML spec in the following PR:
whatwg/html#11980

This patch is passing video and audio WPT tests from the following PR:
web-platform-tests/wpt#57051

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::lazyLoadMediaObserver):
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):
(WebCore::HTMLMediaElement::attributeChanged):
(WebCore::HTMLMediaElement::didFinishInsertingNode):
(WebCore::HTMLMediaElement::removedFromAncestor):
(WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue):
(WebCore::HTMLMediaElement::isLazyLoadable const):
(WebCore::HTMLMediaElement::loadDeferredMedia):
(WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded):
(WebCore::HTMLMediaElement::loading const):
(WebCore::HTMLMediaElement::setLoading):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::sourceWasAdded):
(WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::rendererIsNeeded):
(WebCore::HTMLVideoElement::supportsFullscreen const):
(WebCore::HTMLVideoElement::hasAvailableVideoFrame const):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::loadDeferredMedia):
* Source/WebCore/html/HTMLVideoElement.h:
* Source/WebCore/html/LazyLoadMediaObserver.cpp: Added.
(WebCore::LazyLoadMediaObserver::observe):
(WebCore::LazyLoadMediaObserver::unobserve):
(WebCore::LazyLoadMediaObserver::intersectionObserver):
(WebCore::LazyLoadMediaObserver::isObserved const):
* Source/WebCore/html/LazyLoadMediaObserver.h: Added.
* Source/WebCore/html/parser/HTMLParserOptions.cpp:
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* Source/WebCore/html/shadow/DataListButtonElement.cpp:
* Source/WebCore/html/shadow/SpinButtonElement.cpp:
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::didUpdateCachedImage):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::updatedHasPendingEvent):
(WebCore::ImageLoader::decode):
credod added a commit to Squarespace/WebKit that referenced this pull request Feb 24, 2026
…ttribute

https://bugs.webkit.org/show_bug.cgi?id=303995

Reviewed by NOBODY (OOPS!).

Implement proposed loading attribute for video and audio elements.
This patch implements a proposed loading attribute for video and audio elements, enabling lazy loading of media sources and video poster images, and deferring autoplay.

This change is proposed to be added to the HTML spec in the following PR:
whatwg/html#11980

This patch is passing video and audio WPT tests from the following PR:
web-platform-tests/wpt#57051

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::lazyLoadMediaObserver):
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):
(WebCore::HTMLMediaElement::attributeChanged):
(WebCore::HTMLMediaElement::didFinishInsertingNode):
(WebCore::HTMLMediaElement::removedFromAncestor):
(WebCore::HTMLMediaElement::hasLazyLoadableAttributeValue):
(WebCore::HTMLMediaElement::isLazyLoadable const):
(WebCore::HTMLMediaElement::loadDeferredMedia):
(WebCore::HTMLMediaElement::resumeLazyLoadingIfNeeded):
(WebCore::HTMLMediaElement::loading const):
(WebCore::HTMLMediaElement::setLoading):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::sourceWasAdded):
(WebCore::HTMLMediaElement::setShouldDelayLoadEvent):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::rendererIsNeeded):
(WebCore::HTMLVideoElement::supportsFullscreen const):
(WebCore::HTMLVideoElement::hasAvailableVideoFrame const):
(WebCore::HTMLVideoElement::webkitEnterFullscreen):
(WebCore::HTMLVideoElement::loadDeferredMedia):
* Source/WebCore/html/HTMLVideoElement.h:
* Source/WebCore/html/LazyLoadMediaObserver.cpp: Added.
(WebCore::LazyLoadMediaObserver::observe):
(WebCore::LazyLoadMediaObserver::unobserve):
(WebCore::LazyLoadMediaObserver::intersectionObserver):
(WebCore::LazyLoadMediaObserver::isObserved const):
* Source/WebCore/html/LazyLoadMediaObserver.h: Added.
* Source/WebCore/html/parser/HTMLParserOptions.cpp:
* Source/WebCore/html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
* Source/WebCore/html/shadow/DataListButtonElement.cpp:
* Source/WebCore/html/shadow/SpinButtonElement.cpp:
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::didUpdateCachedImage):
(WebCore::ImageLoader::notifyFinished):
(WebCore::ImageLoader::updatedHasPendingEvent):
(WebCore::ImageLoader::decode):
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.

7 participants