From e2fc993334698b2a66dd24a671a9c23705df0fc3 Mon Sep 17 00:00:00 2001 From: Brandon Aaron Date: Wed, 19 Dec 2007 19:07:12 +0000 Subject: [PATCH] offset: make sure there is a parent node to work on while calculating scroll offsets (#2073) --- src/offset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/offset.js b/src/offset.js index cf1af337d..8ee5680de 100644 --- a/src/offset.js +++ b/src/offset.js @@ -55,7 +55,7 @@ jQuery.fn.offset = function() { } // Get parent scroll offsets - while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) { + while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) ) // Subtract parent scroll offsets