lozad.js
lozad.js copied to clipboard
Elements aren't Unobserved if Loaded via triggerLoad
I noticed that the triggerLoad function currently does not unobserve elements, so an unnecessary onIntersection can still happen that will return immediately due to the isLoaded check. I had the idea in my fork to instead of just adding observer.unobserve(element) in triggerLoad to also have the onIntersection and observe methods call triggerLoad instead of duplicating the code from triggerLoad. Would this be a sane change?
https://github.com/TiKevin83/lozad.js/commit/97e02bed37d0185eaccad9883a4d09c57f9f9604
yes, it should unobserve element after it's loaded by any means
Has this been incorporated into the main branch @ApoorvSaxena ? Thanks for the great plugin!