-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
switchLoadingClass getting called twice for same img #614
Comments
There are browsers where a I assume you simply don't understand why I do things I'm doing. And then overact by claiming with things that are simply untrue. This is also shown by your other not linked issue where you simply do not understand the difference between throttle and debounce and start to open issues because it must be a bug because you don't understand it. If you know a little bit about JS and how the browser renders you would know that executing the following code inside of one element.classList.add('lazyloaded');
element.classList.add('lazyloaded');
element.classList.add('lazyloaded');
element.classList.add('lazyloaded'); This is for example also explained here. It might not be nice but never ever produces any performance issues otherwise I would have worked it out another way. So why do you claim there are performance issues with lazySizes? On the other hand your linked and here advertised yall is producing obvious DOM leaks in dynamic websites, is binding an active |
Today we wanted to import lazysizes to our project. We are using it to load images and our each img is:
<img
class="lazyload" data-src=".." alt="..." />The images are only in vertical scroll mode (haven't tried with horizontal scroll yet). We are using your latest version, v4.1.6.
During testing, I notice that switchLoadingClass is getting called twice.
One call is due to:
addRemoveLoadEvents(elem, rafSwitchLoadingClass, true); <- line 486
Second call is due to:
switchLoadingClass(event) in raF(...) <-- line 520
This 2nd call can be stopped (and it works fine) if I pull out the conditional check outside raF(). Seems that during the raF execution, both elem.complete and (elem.naturalWidth > 1) are 'true'.
This is what I did:
Not sure if the 2nd call is necessary, but to us it seems redundant. Hence this report.
The text was updated successfully, but these errors were encountered: