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
IntersectionObserver
IntersectionObserverInit
observe
unobserve
isIntersecting
target
The will lazy load element steps, given an element element, + are as follows:
+ +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.
+If element's lazy loading attribute is in the Lazy state, then return true.
Return false.
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:
+ +Let doc be element's node document.
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.
The callback is these steps, with arguments entries and + observer:
+ +For each entry in entries using a method of + iteration which does not trigger developer-modifiable array accessors or + iteration hooks: + +
If entry.isIntersecting
is true, set
+ entry.target
's
+ ready to be lazy loaded boolean to true.
The intention is to use the original value of the
+ isIntersecting
and
+ target
getters. See w3c/IntersectionObserver#427.
+
The options is an IntersectionObserverInit
dictionary with the
+ following dictionary members: «[ "rootMargin
" → an
+ implementation-defined value ]»
See issue #5408.
+ +This allows for fetching the image during scrolling, when it does not yet — + but is about to — intersect the viewport.
+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.
+
To stop intersection-observing a lazy loading element element, run these + steps:
+ +Let doc be element's node document.
Assert: doc's lazy load intersection observer is not + null.
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.
+
The will lazy load image steps, given an img
element img,
- are as follows:
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.
-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.
-Return false.
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:
Start intersection-observing a lazy loading element for the
+ img
element.
Continue running this algorithm in parallel.
Wait until the will lazy load image steps no longer return true, given the +
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
.
Stop intersection-observing a lazy loading element for the img
+ element.
Queue an element task on the DOM manipulation task source
given the img
element to continue running the rest of this algorithm.