question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add srcset support

See original GitHub issue

Using the recommended markup (http://www.filamentgroup.com/lab/to-picturefill.html) for <img> with srcset while using picturefill seems to break imagesLoaded on browsers with native support for srcset. Let’s say I have an image like

<img srcset="image-400.jpg 400w,
             image-800.jpg 800w,
             image-1600.jpg 1600w"
>

We don’t use src here to avoid loading two images. Then we use use picturefill for browsers that don’t support srcset natively.

In both browsers with and without native support (thanks to picturefill) the right image is loaded, but imagesLoaded reports the image broken on browsers with native support (resulting in not being able to fade the image in smoothly when loaded)

Check out this reduced test case on latest Firefox (v.35: working) and Chrome (v.40: broken): http://codepen.io/superstructure-net/pen/EaWvZv/

Any ideas? Thx!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:87
  • Comments:22 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
DaAwesomePcommented, Mar 10, 2020

Is it a known bug that there is a side-affect where the browser will end up loading two images?

I am seeing an issue where the browser loads the srcset image and then a little later imagesLoaded loads the fallback image. In many cases the fallback image is much larger since it is not size-selected by the browser.

5reactions
tiagogoncommented, Jun 19, 2015

+1… imagesloaded also doesn’t work here with “srcset”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Srcset and sizes attributes | | Can I use... Support ... - CanIUse
Global · Chrome · Edge * · Safari · Firefox · Opera · IE · Chrome for Android.
Read more >
HTMLImageElement.srcset - Web APIs | MDN
The HTMLImageElement property srcset is a string which identifies one or more image candidate strings, separated using commas ( , ) each ...
Read more >
What Img Srcset Does In HTML5: A Quick & Simple Guide »
Attribute of: HTML Tags Guide To Adding Images To Your Web Documents; What does What Img ... 6 All Attributes of img Element;...
Read more >
Responsive Images with srcset - imgix Documentation
Learn how to use srcset to support different device pixel ratios with imgix. ... images possible with srcset and imgix. imgix affords the...
Read more >
How to Use HTML5 “picture”, “srcset”, and “sizes” for ...
If the browser doesn't support srcset , (something that's only an issue for quite old browsers), it will fall back to showing the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found