From bdce86dc2edb43267ec5c4b7aab6d1932f294d6f Mon Sep 17 00:00:00 2001 From: timmywil Date: Wed, 25 May 2011 19:59:29 -0400 Subject: [PATCH] Move window/document test to dimensions for consistency --- src/css.js | 5 ----- src/dimensions.js | 12 ++++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/css.js b/src/css.js index 10d36b76..e3ab270f 100644 --- a/src/css.js +++ b/src/css.js @@ -170,11 +170,6 @@ jQuery.each(["height", "width"], function( i, name ) { get: function( elem, computed, extra ) { var val; - // Tests for window/document - if ( !elem.style ) { - return null; - } - if ( computed ) { if ( elem.offsetWidth !== 0 ) { val = getWH( elem, name, extra ); diff --git a/src/dimensions.js b/src/dimensions.js index 1ab92d1d..8559056b 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -7,17 +7,17 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { // innerHeight and innerWidth jQuery.fn["inner" + name] = function() { - var ret; - return this[0] && !isNaN( ret = parseFloat(jQuery.css( this[0], type, "padding" )) ) ? - ret : + var elem = this[0]; + return elem && elem.style ? + parseFloat( jQuery.css( elem, type, "padding" ) ) : null; }; // outerHeight and outerWidth jQuery.fn["outer" + name] = function( margin ) { - var ret; - return this[0] && !isNaN( ret = parseFloat(jQuery.css( this[0], type, margin ? "margin" : "border" )) ) ? - ret : + var elem = this[0]; + return elem && elem.style ? + parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) : null; };