nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.28k stars 253 forks source link

fix: move src attribute to end of <img> tag to fix lazy loading (#1317) #1338

Closed Ragura closed 2 months ago

Ragura commented 2 months ago

As described in this Vue core issue (https://github.com/vuejs/core/issues/10764), using the src attribute before loading results in the lazy-loading being inconsistent across loads. This PR moves the src tag to the last position in the element.

I tested the behavior before and after the change in the playground to confirm it is working correctly. If you want I can also commit the playground page for reference.

Feel free to correct me on anything I might have done wrong, be it in the code or while making this PR. I'm not very experienced with the process of contributing to public repos yet!