]> source.dussan.org Git - jquery.git/commitdiff
Make sure body is defined before attempting to use its properties. This check prevent... 451/head
authorscottjehl <scott@scottjehl.com>
Tue, 2 Aug 2011 22:38:35 +0000 (18:38 -0400)
committerscottjehl <scott@scottjehl.com>
Tue, 2 Aug 2011 22:38:35 +0000 (18:38 -0400)
src/dimensions.js

index 88fa17506160c7a7ba597588a9215f710c264c9e..d54776536c109e67a896ca5e57f7a1dae13057ec 100644 (file)
@@ -38,9 +38,10 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
                if ( jQuery.isWindow( elem ) ) {
                        // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
                        // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
-                       var docElemProp = elem.document.documentElement[ "client" + name ];
+                       var docElemProp = elem.document.documentElement[ "client" + name ],
+                               body = elem.document.body;
                        return elem.document.compatMode === "CSS1Compat" && docElemProp ||
-                               elem.document.body[ "client" + name ] || docElemProp;
+                               body && body[ "client" + name ] || docElemProp;
 
                // Get document width or height
                } else if ( elem.nodeType === 9 ) {