Permalink
Browse files

Offset: return before getBoundingClientRect to avoid error in IE8-11

  • Loading branch information...
timmywil committed Jun 16, 2015
1 parent 40dcc76 commit 0e4477c676db0427bb9b0bf39df8631501e62f24
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/offset.js
View
@@ -90,10 +90,17 @@ jQuery.fn.extend({
return;
}
// Support: IE<=11+
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if ( !elem.getClientRects().length ) {
return { top: 0, left: 0 };
}
rect = elem.getBoundingClientRect();
// Make sure element is not hidden (display: none) or disconnected
if ( rect.width || rect.height || elem.getClientRects().length ) {
// Make sure element is not hidden (display: none)
if ( rect.width || rect.height ) {
doc = elem.ownerDocument;
win = getWindow( doc );
docElem = doc.documentElement;

0 comments on commit 0e4477c

Please sign in to comment.