diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-04-18 16:43:25 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-04-18 16:43:25 +0200 |
commit | d3dc637b657b9e491c24a5d1ccd278178f102844 (patch) | |
tree | a7bb8d5cb43df1f2d6f9540aed39c5005abba990 /ui | |
parent | f594c0623ae096165df88160575ef55952be92c0 (diff) | |
download | jquery-ui-d3dc637b657b9e491c24a5d1ccd278178f102844.tar.gz jquery-ui-d3dc637b657b9e491c24a5d1ccd278178f102844.zip |
Position: Cleanup variable definitions, move undefined vars to the top
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.position.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 7d30e4bca..5be90dcfe 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -86,17 +86,13 @@ $.fn.position = function( options ) { // make a copy, we don't want to modify arguments options = $.extend( {}, options ); - var target = $( options.of ), + var atOffset, targetWidth, targetHeight, targetOffset, basePosition, + target = $( options.of ), within = $.position.getWithinInfo( options.within ), scrollInfo = $.position.getScrollInfo( within ), targetElem = target[0], collision = ( options.collision || "flip" ).split( " " ), - offsets = {}, - atOffset, - targetWidth, - targetHeight, - targetOffset, - basePosition; + offsets = {}; if ( targetElem.nodeType === 9 ) { targetWidth = target.width(); @@ -173,7 +169,8 @@ $.fn.position = function( options ) { basePosition.top += atOffset[ 1 ]; return this.each(function() { - var elem = $( this ), + var collisionPosition, using, + elem = $( this ), elemWidth = elem.outerWidth(), elemHeight = elem.outerHeight(), marginLeft = parseCss( this, "marginLeft" ), @@ -181,9 +178,7 @@ $.fn.position = function( options ) { collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, position = $.extend( {}, basePosition ), - myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ), - collisionPosition, - using; + myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); if ( options.my[ 0 ] === "right" ) { position.left -= elemWidth; |