mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Offset: return before getBoundingClientRect to avoid error in IE8-11
This commit is contained in:
parent
63f19a95b9
commit
25e8620da9
@ -95,10 +95,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;
|
||||
|
Loading…
Reference in New Issue
Block a user