Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast lightweight loading attribute polyfill #50

Closed
provok-me opened this issue Oct 22, 2020 · 6 comments
Closed

Fast lightweight loading attribute polyfill #50

provok-me opened this issue Oct 22, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@provok-me
Copy link

Loading="lazy" is the future

I saw that internally you used the IntersectionObserver API by default instead of the new loading attribute.

Compatibility

I know that the loading attribute is not well supported yet... but there's a lightweight polyfill that you could use today.
It is only 2.88 KB for the minified version. Moreover, the polyfill is compatible down to IE 9.

The benefits

In order to make a huge improvement for todays web performance challenges, you could implement the loading attribute polyfill.
This means less code maintenance, consequently less potential technical debt and a faster seo friendly nuxt-image component.

It could also allow you to avoid development errors (and therefore new issues from the community) due to custom providers urls encoding, url transformations and static generation.

See: https://github.com/mfranzke/loading-attribute-polyfill

@farnabaz farnabaz added the enhancement New feature or request label Oct 26, 2020
@AndrewBogdanovTSS
Copy link

AndrewBogdanovTSS commented Nov 10, 2020

To me this polyfill looks strange since it requires generation of noscript which has known SSR issues vuejs/vue#8996 . I think it's better to do something similar to what is done in vanilla-lazyload - it uses native lazy load and falls back to IntersectionObserver if native is not supported

@Suven
Copy link

Suven commented Dec 5, 2020

For the meantime, if you don't care too much about backwards-compability (which for me is fine.. because missing lazy-loading is not breaking the site. Having lazyloading is a progressive enhancement to me) you can just add :lazy="false" loading="lazy" as props to the component-call.

That said, I really would love to see that this component moves from a custom lazy-loading to the native one. The main argument to me really is SEO as crawlers (and also stuff like facebook) would not be able to see the images in the current implementation.

@AndrewBogdanovTSS
Copy link

@Suven yeah, it would be great to see this component become the new Nuxt standard for using images, similar to how Next deprecates standard img tag in favor of https://nextjs.org/docs/api-reference/next/image

@danielroe
Copy link
Member

We do not plan to support a polyfill for loading=lazy as this is now broadly supported: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading#browser_compatibility.

You can of course always add your own polyfill...

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@AndrewBogdanovTSS
Copy link

@danielroe sometimes it just requires to wait for 4 years to resolve the issue, right? 😂

@danielroe
Copy link
Member

I guess! Though in reality this probably could have been closed with the release of v1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants