From 154c5e5fd1d6de9dac369914eb98b5b966cdfae1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 10 Jun 2011 16:07:03 -0400 Subject: [PATCH] Position: Coding standards. --- ui/jquery.ui.position.js | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 51e7561b3..3bae0d010 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -20,30 +20,35 @@ var rhorizontal = /left|center|right/, _position = $.fn.position; $.position = { - scrollbarWidth : function() { - var div = $( "
" ), - innerDiv = div.children()[0], - w1, w2; - $( "body" ).append( div ); - w1 = innerDiv.offsetWidth; - div.css( "overflow", "scroll" ); - - w2 = innerDiv.offsetWidth; - + scrollbarWidth: function() { + var w1, w2, + div = $( "
" ), + innerDiv = div.children()[0]; + + $( "body" ).append( div ); + w1 = innerDiv.offsetWidth; + div.css( "overflow", "scroll" ); + + w2 = innerDiv.offsetWidth; + if ( w1 === w2 ) { w2 = div[0].clientWidth; } - div.remove(); - - return w1 - w2; + div.remove(); + + return w1 - w2; }, - getScrollInfo : function( within ) { + getScrollInfo: function( within ) { var that = within[0], scrollHeight = within.height() < that.scrollHeight, scrollWidth = within.width() < that.scrollWidth, scrollbarWidth = $.position.scrollbarWidth(); - return { height : scrollHeight ? scrollbarWidth : 0, width : scrollWidth ? scrollbarWidth : 0 }; + + return { + height: scrollHeight ? scrollbarWidth : 0, + width : scrollWidth ? scrollbarWidth : 0 + }; } }; @@ -85,7 +90,7 @@ $.fn.position = function( options ) { } // force my and at to have valid horizontal and vertical positions - // if a value is missing or invalid, it will be converted to center + // if a value is missing or invalid, it will be converted to center $.each( [ "my", "at" ], function() { var pos = ( options[ this ] || "" ).split( " " ), horizontalOffset, @@ -302,7 +307,7 @@ $.ui.position = { data.targetHeight : -data.targetHeight, offset = -2 * data.offset[ 1 ]; - if ( overTop < 0 || overBottom > 0) { + if ( overTop < 0 || overBottom > 0 ) { position.top += myOffset + atOffset + offset; } } @@ -345,4 +350,4 @@ if ( $.uiBackCompat !== false ) { }( jQuery ) ); } -}( jQuery ) ); \ No newline at end of file +}( jQuery ) ); -- 2.39.5