aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/css.js8
-rw-r--r--src/dimensions.js42
2 files changed, 24 insertions, 26 deletions
diff --git a/src/css.js b/src/css.js
index 88c4ffa05..30cecf39d 100644
--- a/src/css.js
+++ b/src/css.js
@@ -169,15 +169,11 @@ jQuery.each(["height", "width"], function( i, name ) {
});
}
- if ( val < 0 ) {
- return elem.style[ name ] || "0px";
- }
-
- if ( val === 0 ) {
+ if ( val <= 0 ) {
val = curCSS( elem, name, name );
if ( val != null ) {
- return val;
+ return val === "auto" ? "" : val;
}
}
diff --git a/src/dimensions.js b/src/dimensions.js
index 5aafbf41e..f5212e1b6 100644
--- a/src/dimensions.js
+++ b/src/dimensions.js
@@ -33,27 +33,29 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
});
}
- return jQuery.isWindow( elem ) ?
+ if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
- elem.document.body[ "client" + name ] :
-
- // Get document width or height
- (elem.nodeType === 9) ? // is it a document
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- Math.max(
- elem.documentElement["client" + name],
- elem.body["scroll" + name], elem.documentElement["scroll" + name],
- elem.body["offset" + name], elem.documentElement["offset" + name]
- ) :
-
- // Get or set width or height on the element
- size === undefined ?
- // Get width or height on the element
- parseFloat( jQuery.css( elem, type ) ) :
-
- // Set the width or height on the element (default to pixels if value is unitless)
- this.css( type, typeof size === "string" ? size : size + "px" );
+ return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
+ elem.document.body[ "client" + name ];
+
+ // Get document width or height
+ } else if ( elem.nodeType === 9 ) {
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ return Math.max(
+ elem.documentElement["client" + name],
+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
+ elem.body["offset" + name], elem.documentElement["offset" + name]
+ );
+
+ // Get or set width or height on the element
+ } else if ( size === undefined ) {
+ 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)
+ } else {
+ return this.css( type, typeof size === "string" ? size : size + "px" );
+ }
};
});