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

Can't preload for type-switching <picture>s #6400

Open
eeeps opened this issue Feb 19, 2021 · 1 comment
Open

Can't preload for type-switching <picture>s #6400

eeeps opened this issue Feb 19, 2021 · 1 comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: fetch topic: resource hints (inc. preload)

Comments

@eeeps
Copy link
Contributor

eeeps commented Feb 19, 2021

This was originally discussed when we were figuring out imgsrcset and imgsizes, but I encountered it again this week, and I thought it was worth documenting in its own issue.

Let's say I have the following <picture>

<picture>
  <source
    type="image/avif"
    srcset="a.avif"
  />
  <img
    src="a.jpg"
    alt="" />
</picture>

There's no way to preload just the AVIF, in browsers that support AVIF, and just the JPEG, in browsers that don't support AVIF. The best we can do right now is:

<link
  rel="preload"
  as="image"
  href="a.avif"
  type="image/avif"
/>

Which preloads the AVIF in browsers that support it, and doesn't preload the JPEG for anyone. Honestly this isn't the worst thing in the world, when preload is framed as an enhancement, but it is kind of a bummer that adopting a bleeding-edge image format forces a performance regression for older/non-supporting browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest topic: fetch topic: resource hints (inc. preload)
Development

No branches or pull requests

2 participants