You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably due to the use of an intermediate image object internally.
Once that image is loaded the src attribute of the original image is set.
But there is no guarantee that this image will be available immediately.
I guess this is mostly due to UAs decoding images in a background thread today.
There might be other circumstances that can trigger this race-condition.
I tested this with Chrome/78.0.3904.108 and http://ocbnet.ch/jqlazy/
To trigger it I only have to scroll from the top of the page.
If the threshold is already met on load it seems to be ok.
To circumvent this I added another check in afterLoad:
IMHO it would be great if this could be integrated into this plugin.
Or at least state this race-condition clearly in the documentation.
AFAICT for background-images this might not be solvable cleanly.
The text was updated successfully, but these errors were encountered:
I think you just confused two things. The after load of the image object and the after load (or maybe after handle) of Lazy. The callback is just executed after Lazy does it's job. But i totally understand that in this case the name "load" is confusing and as you stated not true. When i have time i will think about that behavior, but this could have a bigger impact to the whole handling.
Thanks for the reply, as I mentioned it would at least be great to document this somehow.
I guess one can easy get the impression that this would be the case as it mostly does,
so it can be hard to debug any regressions that stem from this edge condition.
But it also seems I can only trigger this in chrome when I disable caching (probably also the
case when server doesn't allow caching, the images are also downloaded twice as shown in
the network tab). It looks like .on('load', function() { ... }) also works out of the box.
AFAICT there is also a small documentation error on the main page as seen below:
The bug we're currently investigating is on iOS, but I thought this might be the main
reason why it happens. Will probably see tomorrow when we test it on a real device.
So hopefully we just have to use another (already existing) callback.
Anyway, maybe you can come up with some solution like re-using the image object or
adding the intermediate image to the DOM instead of "transferring" the src attribute.
Not sure if HTMLImageElement.decode() could be of any help here and converting
it to a Base64 URL might be to CPU intensive.
As the title says, on
afterLoad
the images may not yet be completely loaded.This is probably due to the use of an intermediate image object internally.
Once that image is loaded the
src
attribute of the original image is set.But there is no guarantee that this image will be available immediately.
I guess this is mostly due to UAs decoding images in a background thread today.
There might be other circumstances that can trigger this race-condition.
I tested this with Chrome/78.0.3904.108 and http://ocbnet.ch/jqlazy/
To trigger it I only have to scroll from the top of the page.
If the threshold is already met on load it seems to be ok.
To circumvent this I added another check in
afterLoad
:IMHO it would be great if this could be integrated into this plugin.
Or at least state this race-condition clearly in the documentation.
AFAICT for background-images this might not be solvable cleanly.
The text was updated successfully, but these errors were encountered: