Lazy loading resources is one of the important parts of web performance tuning, simply because offscreen resources can add a lot of weight to your ...
For further actions, you may consider blocking this person and/or reporting abuse
Great writeup!
I've had trouble being sure about this as written in different places. Is the
auto
value going to be as if this feature never existed or does it mean that the browser will choose the behavior and things still might be "lazier" than they had been in the past?...does that question make sense?
I really really like this. DEV implemented this feature as soon as we possibly could.
If you enable "lazy loading" in chrome://flags, your DEV browsing experience will be moderately more efficient 😄
Ben Halpern ・ May 9 ・ 1 min read
I just did a quick pass to get it in some images, still need to go through more of the site and implement this in more places, especially with iframe embeds.
Thanks Ben, the auto means you are delegating the responsibility to the browser. As I mentioned, each browsers has a different way of dealing with depriotising offscreen resources, so they will use it. Also if a browser doesn't have any strategy (which is possible) then it's equal to eager
Auto, for now, will be the same as eager but the browser makers will get to choose.
github.com/whatwg/html/pull/3752/f...
'loading' in HTMLImageElement.prototype
should always returntrue
orfalse
so you shouldn't need to then compare the result totrue
like in'loading' in HTMLImageElement.prototype === true
.Does this work with divs or other elements that have overflow:auto? Or just with scrolling the body element?
Or for example modals that are in dom and have images with lazy loading attribute, but are positioned outside the view and waiting to be shown with top:0 for example?
Yes, for divs with overflow auto it will work fine. However, I am not too sure about Modals, have a look at the Distance Threshold to see how close to coming into viewport should the element be to trigger the request.
PS: If you gave it a shot for Modals, let me know and I'll update the article, that's a good one. I will try to test it myself later this week too
what about images in backgrounds ?
If you mean with CSS, that's not there yet as mentioned in the article