1212$ . ui = $ . ui || { } ;
1313
1414var horizontalPositions = / l e f t | c e n t e r | r i g h t / ,
15- horizontalDefault = "center" ,
1615 verticalPositions = / t o p | c e n t e r | b o t t o m / ,
17- verticalDefault = "center" ,
16+ center = "center" ,
1817 _position = $ . fn . position ,
1918 _offset = $ . fn . offset ;
2019
@@ -58,13 +57,13 @@ $.fn.position = function( options ) {
5857 var pos = ( options [ this ] || "" ) . split ( " " ) ;
5958 if ( pos . length === 1 ) {
6059 pos = horizontalPositions . test ( pos [ 0 ] ) ?
61- pos . concat ( [ verticalDefault ] ) :
60+ pos . concat ( [ center ] ) :
6261 verticalPositions . test ( pos [ 0 ] ) ?
63- [ horizontalDefault ] . concat ( pos ) :
64- [ horizontalDefault , verticalDefault ] ;
62+ [ center ] . concat ( pos ) :
63+ [ center , center ] ;
6564 }
66- pos [ 0 ] = horizontalPositions . test ( pos [ 0 ] ) ? pos [ 0 ] : horizontalDefault ;
67- pos [ 1 ] = verticalPositions . test ( pos [ 1 ] ) ? pos [ 1 ] : verticalDefault ;
65+ pos [ 0 ] = horizontalPositions . test ( pos [ 0 ] ) ? pos [ 0 ] : center ;
66+ pos [ 1 ] = verticalPositions . test ( pos [ 1 ] ) ? pos [ 1 ] : center ;
6867 options [ this ] = pos ;
6968 } ) ;
7069
@@ -82,13 +81,13 @@ $.fn.position = function( options ) {
8281
8382 if ( options . at [ 0 ] === "right" ) {
8483 basePosition . left += targetWidth ;
85- } else if ( options . at [ 0 ] === horizontalDefault ) {
84+ } else if ( options . at [ 0 ] === center ) {
8685 basePosition . left += targetWidth / 2 ;
8786 }
8887
8988 if ( options . at [ 1 ] === "bottom" ) {
9089 basePosition . top += targetHeight ;
91- } else if ( options . at [ 1 ] === verticalDefault ) {
90+ } else if ( options . at [ 1 ] === center ) {
9291 basePosition . top += targetHeight / 2 ;
9392 }
9493
@@ -103,13 +102,13 @@ $.fn.position = function( options ) {
103102
104103 if ( options . my [ 0 ] === "right" ) {
105104 position . left -= elemWidth ;
106- } else if ( options . my [ 0 ] === horizontalDefault ) {
105+ } else if ( options . my [ 0 ] === center ) {
107106 position . left -= elemWidth / 2 ;
108107 }
109108
110109 if ( options . my [ 1 ] === "bottom" ) {
111110 position . top -= elemHeight ;
112- } else if ( options . my [ 1 ] === verticalDefault ) {
111+ } else if ( options . my [ 1 ] === center ) {
113112 position . top -= elemHeight / 2 ;
114113 }
115114
@@ -154,7 +153,7 @@ $.ui.position = {
154153
155154 flip : {
156155 left : function ( position , data ) {
157- if ( data . at [ 0 ] === " center" ) {
156+ if ( data . at [ 0 ] === center ) {
158157 return ;
159158 }
160159 var win = $ ( window ) ,
@@ -175,7 +174,7 @@ $.ui.position = {
175174 0 ;
176175 } ,
177176 top : function ( position , data ) {
178- if ( data . at [ 1 ] === " center" ) {
177+ if ( data . at [ 1 ] === center ) {
179178 return ;
180179 }
181180 var win = $ ( window ) ,
0 commit comments