From: Brandon Aaron Date: Wed, 19 Dec 2007 19:07:12 +0000 (+0000) Subject: offset: make sure there is a parent node to work on while calculating scroll offsets... X-Git-Tag: 1.2.2b2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e2fc993334698b2a66dd24a671a9c23705df0fc3;p=jquery.git offset: make sure there is a parent node to work on while calculating scroll offsets (#2073) --- 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