]> source.dussan.org Git - jquery.git/commitdiff
offset: make sure there is a parent node to work on while calculating scroll offsets...
authorBrandon Aaron <brandon.aaron@gmail.com>
Wed, 19 Dec 2007 19:07:12 +0000 (19:07 +0000)
committerBrandon Aaron <brandon.aaron@gmail.com>
Wed, 19 Dec 2007 19:07:12 +0000 (19:07 +0000)
src/offset.js

index cf1af337d0e2ac47bf9434dcdc8932db1ba3fbbd..8ee5680deb287c35bf8669c2a903fdb441381454 100644 (file)
@@ -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