From d9b1d3436aac059ff2cdddb89f4b8fdc260366e1 Mon Sep 17 00:00:00 2001
From: John Resig <jeresig@gmail.com>
Date: Fri, 16 Jun 2006 00:09:51 +0000
Subject: [PATCH] $.css() now accounts for borders in addition to padding when
 calculating the height/width of an element.

---
 jquery/jquery.js |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/jquery/jquery.js b/jquery/jquery.js
index b7a2799..3e7ffa6 100644
--- a/jquery/jquery.js
+++ b/jquery/jquery.js
@@ -353,10 +353,15 @@ $.apply = function(o,f,a) {
 $.getCSS = function(e,p) {
 	// Adapted from Prototype 1.4.0
 	if ( p == 'height' || p == 'width' ) {
-		var ph = $.browser == "msie" ? 0 : 
-			parseInt($.css(e,"paddingTop")) + parseInt($.css(e,"paddingBottom"));
-		var pw = $.browser == "msie" ? 0 : 
-			parseInt($.css(e,"paddingLeft")) + parseInt($.css(e,"paddingRight"));
+
+		// Handle extra width/height provided by the W3C box model
+		var ph = !$.boxModel ? 0 : 
+			parseInt($.css(e,"paddingTop")) + parseInt($.css(e,"paddingBottom")) +
+			parseInt($.css(e,"borderTop")) + parseInt($.css(e,"borderBottom"));
+
+		var pw = !$.boxModel ? 0 : 
+			parseInt($.css(e,"paddingLeft")) + parseInt($.css(e,"paddingRight")) +
+			parseInt($.css(e,"borderLeft")) + parseInt($.css(e,"borderRight"));
 
 		var oHeight, oWidth;
 
-- 
1.7.10.4