Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Landing pull request 413. Move border/padding checks to after width v…

…alidation to avoid unnecessary fallbacks. Fixes #9598.

More Details:
 - #413
 - http://bugs.jquery.com/ticket/9300
 - http://bugs.jquery.com/ticket/9441
 - http://bugs.jquery.com/ticket/9598
  • Loading branch information...
commit 124817e6684086ccf74e509309b73d4b4dd89932 1 parent d59b0f3
Mike Sherov authored June 17, 2011 timmywil committed June 17, 2011

Showing 1 changed file with 10 additions and 11 deletions. Show diff stats Hide diff stats

  1. 21  src/css.js
21  src/css.js
@@ -315,21 +315,20 @@ function getWH( elem, name, extra ) {
315 315
 	var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
316 316
 		which = name === "width" ? cssWidth : cssHeight;
317 317
 
318  
-	if ( extra !== "margin" && extra !== "border" ) {
319  
-		jQuery.each( which, function() {
320  
-			val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
321  
-			if ( !extra ) {
322  
-				val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
323  
-			}
324  
-		});
325  
-	}
326  
-
327 318
 	if ( val > 0 ) {
328  
-		if ( extra === "margin" ) {
  319
+		if ( extra !== "border" ) {
329 320
 			jQuery.each( which, function() {
330  
-				val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
  321
+				if ( !extra ) {
  322
+					val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
  323
+				}
  324
+				if ( extra === "margin" ) {
  325
+					val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
  326
+				} else {
  327
+					val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
  328
+				}
331 329
 			});
332 330
 		}
  331
+
333 332
 		return val + "px";
334 333
 	}
335 334
 

0 notes on commit 124817e

Please sign in to comment.
Something went wrong with that request. Please try again.