]> source.dussan.org Git - jquery.git/commitdiff
Move window/document test to dimensions for consistency
authortimmywil <tim.willison@thisismedium.com>
Wed, 25 May 2011 23:59:29 +0000 (19:59 -0400)
committertimmywil <tim.willison@thisismedium.com>
Wed, 25 May 2011 23:59:29 +0000 (19:59 -0400)
src/css.js
src/dimensions.js

index 10d36b765ed1326bd427e882552f28f0b1f86fcc..e3ab270fc61aa52a4b8346adb34d7d977fcece0e 100644 (file)
@@ -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 );
index 1ab92d1dd6b5baaf5b0b46776e6083ddbe355949..8559056b5bd54a523cad63a3b67a752e8d171de4 100644 (file)
@@ -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;
        };