Skip to content

Commit 50170e6

Browse files
author
Russell Holbrook
committed
jQuery.fn.offset no longer returns ClientRect object for disconnected elements
Instead of returning box, which is a ClientRect, we take the top and left box values and place them into a generic object.
1 parent 0838bdf commit 50170e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/offset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
3030

3131
// Make sure we're not dealing with a disconnected DOM node
3232
if ( !box || !jQuery.contains( docElem, elem ) ) {
33-
return box || { top: 0, left: 0 };
33+
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
3434
}
3535

3636
var body = doc.body,

0 commit comments

Comments
 (0)