X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdimensions.js;h=bcef47fdfe3da1fd9e1a27feee35a068e2045874;hb=c66aa570299459ea948eb123a442da6e22a9611b;hp=4dd15446733e6716398b732c5effd8b3c179d98b;hpb=ea44348fdb8d039dd74684cdafc6c73430f297b3;p=jquery.git diff --git a/src/dimensions.js b/src/dimensions.js index 4dd1544..bcef47f 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -1,28 +1,23 @@ // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height", "Width" ], function(i, name){ - var tl = name == "Height" ? "Top" : "Left", // top or left - br = name == "Height" ? "Bottom" : "Right"; // bottom or right - + var tl = i ? "Left" : "Top", // top or left + br = i ? "Right" : "Bottom"; // bottom or right + // innerHeight and innerWidth jQuery.fn["inner" + name] = function(){ - return this[ name.toLowerCase() ]() + - num(this, "padding" + tl) + + return this[ name.toLowerCase() ]() + + num(this, "padding" + tl) + num(this, "padding" + br); }; - + // outerHeight and outerWidth jQuery.fn["outer" + name] = function(margin) { - return this["inner" + name]() + + return this["inner" + name]() + num(this, "border" + tl + "Width") + num(this, "border" + br + "Width") + - (!!margin ? + (margin ? num(this, "margin" + tl) + num(this, "margin" + br) : 0); }; - -}); -function num(elem, prop) { - elem = elem.jquery ? elem[0] : elem; - return elem && parseInt( jQuery.curCSS(elem, prop, true), 10 ) || 0; -} \ No newline at end of file +}); \ No newline at end of file