aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorJordan Boesch <jboesch26@gmail.com>2011-04-15 07:48:50 -0600
committerJordan Boesch <jboesch26@gmail.com>2011-04-15 07:48:50 -0600
commitc4d0cccecf4dc0da677b5c377801c3170242ac6b (patch)
tree405f85c364ec197b78004565f2d0d70c55db7400 /src/css.js
parent8e1467f97eb8facb6677663794eb159eb8fedaab (diff)
downloadjquery-c4d0cccecf4dc0da677b5c377801c3170242ac6b.tar.gz
jquery-c4d0cccecf4dc0da677b5c377801c3170242ac6b.zip
revert to old code, bug is invalid
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js45
1 files changed, 12 insertions, 33 deletions
diff --git a/src/css.js b/src/css.js
index 9db659967..c812c33f3 100644
--- a/src/css.js
+++ b/src/css.js
@@ -339,45 +339,24 @@ curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
var which = name === "width" ? cssWidth : cssHeight,
- cur = curCSS( elem, name ),
-
- // We're addressing the way Firefox handles certain inputs and buttons,
- // offsetWidth/height actually returns a normal width/height
- boxSizing = rinputbutton.test( elem.nodeName ) &&
- ( curCSS( elem, "-moz-box-sizing" ) === "border-box" ||
- curCSS( elem, "box-sizing" ) === "border-box" );
-
- // IE will return auto if we try to grab a width/height that is not set
- if ( boxSizing || cur === "auto" ) {
- cur = name === "width" ? elem.offsetWidth : elem.offsetHeight;
- }
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
- // Make sure that IE7 returns the correct computed value for display
- if ( name === "height" ) {
- elem.offsetHeight;
+ if ( extra === "border" ) {
+ return val;
}
-
- var val = parseFloat( cur ) || 0;
- if ( extra ) {
- for ( var i = 0, len = which.length; i < len ; i++ ) {
- var dir = which[i];
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
+ }
- // outerWidth/height
- if ( extra === "border" || extra === "margin" ) {
- val += parseFloat(jQuery.css( elem, "border" + dir + "Width" )) || 0;
- val += parseFloat(jQuery.css( elem, "padding" + dir )) || 0;
+ if ( extra === "margin" ) {
+ val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
- if ( extra == "margin" ) {
- val += parseFloat(jQuery.css( elem, "margin" + dir )) || 0;
- }
-
- // innerWidth/height
- } else {
- val += parseFloat(jQuery.css( elem, "padding" + dir )) || 0;
- }
+ } else {
+ val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
}
- }
+ });
return val;
}