Skip to content

Commit 154c5e5

Browse files
committed
Position: Coding standards.
1 parent 75408eb commit 154c5e5

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

ui/jquery.ui.position.js

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,35 @@ var rhorizontal = /left|center|right/,
2020
_position = $.fn.position;
2121

2222
$.position = {
23-
scrollbarWidth : function() {
24-
var div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
25-
innerDiv = div.children()[0],
26-
w1, w2;
27-
$( "body" ).append( div );
28-
w1 = innerDiv.offsetWidth;
29-
div.css( "overflow", "scroll" );
30-
31-
w2 = innerDiv.offsetWidth;
32-
23+
scrollbarWidth: function() {
24+
var w1, w2,
25+
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
26+
innerDiv = div.children()[0];
27+
28+
$( "body" ).append( div );
29+
w1 = innerDiv.offsetWidth;
30+
div.css( "overflow", "scroll" );
31+
32+
w2 = innerDiv.offsetWidth;
33+
3334
if ( w1 === w2 ) {
3435
w2 = div[0].clientWidth;
3536
}
3637

37-
div.remove();
38-
39-
return w1 - w2;
38+
div.remove();
39+
40+
return w1 - w2;
4041
},
41-
getScrollInfo : function( within ) {
42+
getScrollInfo: function( within ) {
4243
var that = within[0],
4344
scrollHeight = within.height() < that.scrollHeight,
4445
scrollWidth = within.width() < that.scrollWidth,
4546
scrollbarWidth = $.position.scrollbarWidth();
46-
return { height : scrollHeight ? scrollbarWidth : 0, width : scrollWidth ? scrollbarWidth : 0 };
47+
48+
return {
49+
height: scrollHeight ? scrollbarWidth : 0,
50+
width : scrollWidth ? scrollbarWidth : 0
51+
};
4752
}
4853
};
4954

@@ -85,7 +90,7 @@ $.fn.position = function( options ) {
8590
}
8691

8792
// force my and at to have valid horizontal and vertical positions
88-
// if a value is missing or invalid, it will be converted to center
93+
// if a value is missing or invalid, it will be converted to center
8994
$.each( [ "my", "at" ], function() {
9095
var pos = ( options[ this ] || "" ).split( " " ),
9196
horizontalOffset,
@@ -302,7 +307,7 @@ $.ui.position = {
302307
data.targetHeight :
303308
-data.targetHeight,
304309
offset = -2 * data.offset[ 1 ];
305-
if ( overTop < 0 || overBottom > 0) {
310+
if ( overTop < 0 || overBottom > 0 ) {
306311
position.top += myOffset + atOffset + offset;
307312
}
308313
}
@@ -345,4 +350,4 @@ if ( $.uiBackCompat !== false ) {
345350
}( jQuery ) );
346351
}
347352

348-
}( jQuery ) );
353+
}( jQuery ) );

0 commit comments

Comments
 (0)