toddmotto / echo

Lazy-loading images with data-* attributes

Home Page:http://toddmotto.com/labs/echo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

try... catch on getBoundingClientRect()

gustavopaes opened this issue · comments

When the element is removed from the DOM, in IE 8 and 9, the call getBoundingClientRect() break the code.

I did this:

var inView = function (element, view) {
  // needs `try catch` because in IE < 10, when the element
  // was removed from DOM the getBoundingClientRect() call 
  // break execution
  try {
    var box = element.getBoundingClientRect();
    return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b);
  } catch(e) {
    return false;
  }
};

Maybe #73 resolves too!

Merged #73, can you check that the merged fix, fixes your issue, if it does I can close this issue

Thanks in advance

Resolved. Thank you.

😄 awesome glad i could help