diff --git a/source b/source index addfb3a9d48..a054fe5e503 100644 --- a/source +++ b/source @@ -3746,6 +3746,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute @@ -6906,6 +6912,132 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute data-x="invalid value default">invalid value default are both the Eager state.

+
+ +

The will lazy load element steps, given an element element, + are as follows:

+ +
    +
  1. +

    If scripting is disabled for element, + then return false.

    + +

    This is an anti-tracking measure, because if a user agent supported lazy loading + when scripting is disabled, it would still be possible for a site to track a user's approximate + scroll position throughout a session, by strategically placing images in a page's markup such + that a server can track how many images are requested and when.

    +
  2. + +
  3. If element's lazy loading attribute is in the Lazy state, then return true.

  4. + +
  5. Return false.

  6. +
+ +

Each img element has an associated ready to be lazy loaded boolean, + initially false.

+ +

For img elements that will lazy load, this can be set to true in the lazy load intersection + observer's callback, which causes the image to load by continuing the update the + image data steps.

+ +

Each Document has a lazy load intersection observer, initially set to + null but can be set to an IntersectionObserver instance.

+ +

To start intersection-observing a lazy loading element element, run these + steps:

+ +
    +
  1. Let doc be element's node document.

  2. + +
  3. +

    If doc's lazy load intersection observer is null, set it to a new + IntersectionObserver instance, initialized as follows:

    + +

    The intention is to use the original value of the + IntersectionObserver constructor. However, we're forced to use the + JavaScript-exposed constructor in this specification, until Intersection Observer + exposes low-level hooks for use in specifications. See bug w3c/IntersectionObserver#427 + which tracks this.

    + + +
  4. + +
  5. +

    Call doc's lazy load intersection observer's observe method with element as the + argument.

    + +

    The intention is to use the original value of the observe method. See w3c/IntersectionObserver#427. +

    +
  6. +
+ +

To stop intersection-observing a lazy loading element element, run these + steps:

+ +
    +
  1. Let doc be element's node document.

  2. + +
  3. Assert: doc's lazy load intersection observer is not + null.

  4. + +
  5. +

    Call doc's lazy load intersection observer unobserve method with element as + the argument.

    + +

    The intention is to use the original value of the unobserve method. See w3c/IntersectionObserver#427. +

    +
  6. +
+

Common DOM interfaces

@@ -27440,33 +27572,6 @@ was an English <a href="/wiki/Music_hall">music hall</a> singer, ...Updating the image data -

The will lazy load image steps, given an img element img, - are as follows:

- -
    -
  1. -

    If scripting is disabled for img, return - false.

    - -

    This is an anti-tracking measure, because if a user agent supported lazy loading - when scripting is disabled, it would still be possible for a site to track a user's approximate - scroll position throughout a session, by strategically placing images in a page's markup such - that a server can track how many images are requested and when.

    -
  2. - -
  3. -

    If img's lazy loading attribute is in the Lazy state, img does not intersect the - viewport, and img is not about to intersect the viewport, then - return true.

    - -

    This allows for fetching the image during scrolling, when it does not, but is - about to intersect the viewport.

    -
  4. - -
  5. Return false.

  6. -
-

This algorithm cannot be called from steps running in parallel. If a user agent needs to call this algorithm from steps running in parallel, it needs to queue a task to do so.

@@ -27688,15 +27793,22 @@ was an English <a href="/wiki/Music_hall">music hall</a> singer, ...
  • -

    If the will lazy load image steps given the img return true, +

    If the will lazy load element steps given the img return true, then:

      +
    1. Start intersection-observing a lazy loading element for the + img element.

    2. +
    3. Continue running this algorithm in parallel.

    4. -
    5. Wait until the will lazy load image steps no longer return true, given the +

    6. Wait until the img's ready to be lazy loaded flag is + true, or until the will lazy load element steps no longer return true, given the img.

    7. +
    8. Stop intersection-observing a lazy loading element for the img + element.

    9. +
    10. Queue an element task on the DOM manipulation task source given the img element to continue running the rest of this algorithm.