X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdimensions.js;h=9d8c35454dd98d3f411af1619e439af71b3d175b;hb=73d060b522ccf72847e67f56fea0e9b129ff273e;hp=f5212e1b6b9b67ffc8cf0b9560f2a31f1403d75d;hpb=53396b879bd29c090824da182e3cf69158829f82;p=jquery.git diff --git a/src/dimensions.js b/src/dimensions.js index f5212e1..9d8c354 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -25,7 +25,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { if ( !elem ) { return size == null ? null : this; } - + if ( jQuery.isFunction( size ) ) { return this.each(function( i ) { var self = jQuery( this ); @@ -36,7 +36,7 @@ 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 return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || - elem.document.body[ "client" + name ]; + elem.document.body[ "client" + name ] || window.screen && window.screen[ name.toLowerCase() ]; // Get document width or height } else if ( elem.nodeType === 9 ) { @@ -49,7 +49,9 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { // Get or set width or height on the element } else if ( size === undefined ) { - var orig = jQuery.css( elem, type ), ret = parseFloat( orig ); + var orig = jQuery.css( elem, type ), + ret = parseFloat( orig ); + return jQuery.isNaN( ret ) ? orig : ret; // Set the width or height on the element (default to pixels if value is unitless)