From 8c76fe38bf1012c758bbb0bd7ae04ead4edca906 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 12 Apr 2012 17:48:01 +0200 Subject: Position: Inline center variable. Not necessary with gzip (or a good minifier) in place, wasn't consistent with other inline strings --- ui/jquery.ui.position.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'ui/jquery.ui.position.js') diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 76b9cca21..27493703d 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -16,7 +16,6 @@ var rhorizontal = /left|center|right/, roffset = /[\+\-]\d+%?/, rposition = /^\w+/, rpercent = /%$/, - center = "center", _position = $.fn.position; $.position = { @@ -112,13 +111,13 @@ $.fn.position = function( options ) { if ( pos.length === 1) { pos = rhorizontal.test( pos[ 0 ] ) ? - pos.concat( [ center ] ) : + pos.concat( [ "center" ] ) : rvertical.test( pos[ 0 ] ) ? - [ center ].concat( pos ) : - [ center, center ]; + [ "center" ].concat( pos ) : + [ "center", "center" ]; } - pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : center; - pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : center; + pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; + pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; // calculate offsets horizontalOffset = roffset.exec( pos[ 0 ] ); @@ -142,13 +141,13 @@ $.fn.position = function( options ) { if ( options.at[ 0 ] === "right" ) { basePosition.left += targetWidth; - } else if ( options.at[ 0 ] === center ) { + } else if ( options.at[ 0 ] === "center" ) { basePosition.left += targetWidth / 2; } if ( options.at[ 1 ] === "bottom" ) { basePosition.top += targetHeight; - } else if ( options.at[ 1 ] === center ) { + } else if ( options.at[ 1 ] === "center" ) { basePosition.top += targetHeight / 2; } @@ -171,13 +170,13 @@ $.fn.position = function( options ) { if ( options.my[ 0 ] === "right" ) { position.left -= elemWidth; - } else if ( options.my[ 0 ] === center ) { + } else if ( options.my[ 0 ] === "center" ) { position.left -= elemWidth / 2; } if ( options.my[ 1 ] === "bottom" ) { position.top -= elemHeight; - } else if ( options.my[ 1 ] === center ) { + } else if ( options.my[ 1 ] === "center" ) { position.top -= elemHeight / 2; } @@ -336,7 +335,7 @@ $.ui.position = { }, flip: { left: function( position, data ) { - if ( data.at[ 0 ] === center ) { + if ( data.at[ 0 ] === "center" ) { return; } @@ -376,7 +375,7 @@ $.ui.position = { } }, top: function( position, data ) { - if ( data.at[ 1 ] === center ) { + if ( data.at[ 1 ] === "center" ) { return; } -- cgit v1.2.3