Skip to content
Permalink
Browse files
$.css() now accounts for borders in addition to padding when calculat…
…ing the height/width of an element.
  • Loading branch information
jeresig committed Jun 16, 2006
1 parent a70ab65 commit d9b1d3436aac059ff2cdddb89f4b8fdc260366e1
Showing 1 changed file with 9 additions and 4 deletions.
@@ -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;

0 comments on commit d9b1d34

Please sign in to comment.