dinbror / blazy

Hey, be lazy! bLazy.JS is a lightweight pure JavaScript script for lazy loading and multi-serving images. It's working in all modern browsers including IE7+.
http://dinbror.dk/blazy
MIT License
2.63k stars 355 forks source link

Make sure the element is in the DOM before calling getBoundingClientR… #181

Open poa8a opened 4 years ago

poa8a commented 4 years ago

On some browsers (I think mostly old IE like < IE11) the call to ele.getBoundingClientRect(); threw an uncaught exception if the element wasn't in the DOM. I added a check before the call.