Skip to content

Commit

Permalink
jquery dimensions: removed redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
flesler committed Mar 6, 2009
1 parent ece001f commit 2d4755a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ jQuery.each([ "Height", "Width" ], function(i, name){

var tl = i ? "Left" : "Top", // top or left
br = i ? "Right" : "Bottom", // bottom or right
lower = name.toLowerCase();
type = name.toLowerCase();

// innerHeight and innerWidth
jQuery.fn["inner" + name] = function(){
return this[0] ?
jQuery.css( this[0], lower, false, "padding" ) :
jQuery.css( this[0], type, false, "padding" ) :
null;
};

// outerHeight and outerWidth
jQuery.fn["outer" + name] = function(margin) {
return this[0] ?
jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
null;
};

var type = name.toLowerCase();

jQuery.fn[ type ] = function( size ) {
// Get window width or height
return this[0] == window ?
Expand Down

0 comments on commit 2d4755a

Please sign in to comment.