BKWLD / vue-visual

Vue 2 image and video loader supporting lazy loading, background videos, fixed aspect ratios, low rez poster images, transitions, loaders, slotted content and more.
https://bkwld.github.io/vue-visual
MIT License
59 stars 7 forks source link

Adds support for native loading="lazy" on img tag #56

Closed weotch closed 3 years ago

weotch commented 3 years ago

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading.

My hope is that this will improve PageSpeed scores because we don't need to create IntersectionObserver instances in order to do lazy loading.

weotch commented 3 years ago

In the tests I ran, I didn't notice an improvement in PageSpeed scores. I tested this on a page of a production website and the scores were worse. I think the issue is that the native implementation is less conservative and eager loads images from further down the page (note 11 images loaded rather than 4).

image

I'm not going to merge this because I'm not seeing a benefit and it adds to the code complexity.