diff --git a/source b/source index a65eae126d1..6374d2ab99f 100644 --- a/source +++ b/source @@ -8010,11 +8010,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
lazy
+ lazy
eager
+ eager
Each img and iframe element has associated lazy load resumption
- steps, initially null.
Each img, audio, video, and iframe element has associated
+ lazy load resumption steps, initially null.
For img and iframe elements that will lazy load, these steps are run from the lazy load
- intersection observer's callback or when their lazy loading attribute is set
- to the Eager state. This causes the element to
- continue loading.
For img, audio, video, and iframe elements that
+ will lazy load, these steps are run from the
+ lazy load intersection observer's callback or when their lazy loading
+ attribute is set to the Eager state. This
+ causes the element to continue loading.
Each Document has a lazy load intersection observer, initially set to
null but can be set to an IntersectionObserver instance.
loopmutedcontrolsloadingwidthheightHTMLVideoElement.image", initiator type is "video",
credentials mode is "include", and whose use-URL-credentials flag is set.
+ data-x="">include", and whose use-URL-credentials flag is set.
+
+ If the will lazy load element steps given the video return true,
+ then return.
Fetch request. This must delay the load event of the element's node document.
playsinline attribute has no effect.
+ If the poster attribute is present and the loading attribute is in the Lazy state, the user agent must defer loading the poster
+ image source data until the element's lazy load resumption steps are invoked.
<video src="1.mp4" poster="1.jpg" type="video/mp4">
+<video src="2.mp4" type="video/mp4" loading="eager">
+<video src="3.mp4" type="video/mp4" loading="lazy">
+<video src="4.mp4" type="video/mp4" loading="lazy" autoplay>
+<div id="very-large"></div> <!-- Everything after this div is below the viewport -->
+<video src="5.mp4" type="video/mp4">
+<video src="6.mp4" type="video/mp4" loading="lazy">
+<video src="7.mp4" type="video/mp4" autoplay loading="lazy">
+<video src="8.mp4" type="video/mp4" poster="8.jpg" loading="lazy">
+<video src="9.mp4" type="video/mp4" preload="none" poster="9.jpg" loading="lazy">
+<video src="10.mp4" type="video/mp4" preload="metadata" loading="lazy">
+<video src="11.mp4" type="video/mp4" poster="11.jpg" preload="none" loading="eager">
+
+ In the example above, the videos load as follows:
+ +1.mp4The video and poster image load eagerly and delay the window's load event.
2.mp4, 5.mp4The videos load eagerly and delay the window's load event.
3.mp4The video loads when layout is known, due to being in the viewport, however it does + not delay the window's load event.
4.mp4The video loads and autoplay playback begins when layout is known, due to being in + the viewport, however it does not delay the window's load event.
6.mp4The video loads only once scrolled into the viewport, and does not delay the window's + load event.
7.mp4The video loads and autoplay playback begins only once scrolled into the viewport, + and does not delay the window's load event.
8.mp4The video and poster image load only once scrolled into the viewport, and does not + delay the window's load event.
9.mp4The video does not load until played. The poster image loads only once scrolled into + the viewport, and does not delay the window's load event.
10.mp4The video's metadata loads only once scrolled into the viewport, and does not delay + the window's load event.
11.mp4The video does not load until played. The poster image loads eagerly and delays the window's load event.
track elements, then
loopmutedcontrolsloadingThe src, crossorigin,
preload, autoplay,
- loop, muted, and controls attributes are loop, muted, controls, and loading attributes are the attributes common to all media elements.
audio elements without a controls attribute will not be displayed by the user agent, preventing them from lazy loading.
<audio src="1.mp3" type="audio/mpeg" controls>
+<audio src="2.mp3" type="audio/mpeg" controls loading="eager">
+<audio src="3.mp3" type="audio/mpeg" controls loading="lazy">
+<audio src="4.mp3" type="audio/mpeg" controls loading="lazy" autoplay>
+<div id="very-large"></div> <!-- Everything after this div is below the viewport -->
+<audio src="5.mp3" type="audio/mpeg" controls>
+<audio src="6.mp3" type="audio/mpeg" controls loading="lazy">
+<audio src="7.mp3" type="audio/mpeg" controls autoplay loading="lazy">
+<audio src="8.mp3" type="audio/mpeg" controls preload="metadata" loading="lazy">
+
+ In the example above, the audio files load as follows:
+ +1.mp3, 2.mp3, 5.mp3The audio file loads eagerly and delays the window's load event.
3.mp3The audio loads when layout is known, due to being in the viewport, however it does + not delay the window's load event.
4.mp3The audio loads and autoplay playback begins when layout is known, due to being in + the viewport, however it does not delay the window's load event.
6.mp3The audio loads only once scrolled into the viewport, and does not delay the window's + load event.
7.mp3The audio loads and autoplay playback begins only once scrolled into the viewport, + and does not delay the window's load event.
8.mp3The audio's metadata loads only once scrolled into the viewport, and does not delay + the window's load event.
audio = new Audio([ url ])The media element attributes, src, crossorigin, preload, autoplay,
- loop, muted, and
- controls, apply to all loop, muted, controls, and loading, apply to all media elements. They are defined in this section.
The loading
+ attribute is a lazy loading attribute. Its purpose is to indicate the policy for
+ loading media resources that are outside the viewport.
When the loading attribute's state is changed to the
+ Eager state, the user agent must run these
+ steps:
Let resumptionSteps be the media element's lazy load + resumption steps.
If resumptionSteps is null, then return.
Set the media element's lazy load resumption steps to null.
Invoke resumptionSteps.
The loading
+ IDL attribute must reflect the loading
+ content attribute, limited to only known values.
When the loading attribute is in the Lazy state, it takes precedence over the preload attribute by deferring data fetching.
If the autoplay attribute is present and the loading attribute is in the Lazy state, the user agent must also defer starting
+ playback (and any associated network requests autoplay can introduce) until the element's
+ lazy load resumption steps are invoked.