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-Url: http://git.asbjorn.it/?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 cf1af33..8ee5680 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