aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2012-04-11 00:19:26 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2012-04-11 00:19:26 +0200
commit623e8e68b4e396cd9a3cdb4985c9db343924c4ec (patch)
tree213b55ae601eded66b9ec96834d54402b2ad6e8f /ui
parentc0cceee8e49a57b64ef9e00bedee3fab431e77af (diff)
downloadjquery-ui-623e8e68b4e396cd9a3cdb4985c9db343924c4ec.tar.gz
jquery-ui-623e8e68b4e396cd9a3cdb4985c9db343924c4ec.zip
Position: Mini refactoring, avoids proxying using callback multiple times if more then one element is positioned
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.position.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index cde99cdca..025d2c815 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -170,7 +170,7 @@ $.fn.position = function( options ) {
( rpercent.test( offsets.my[ 1 ] ) ? elem.outerHeight() / 100 : 1 )
],
collisionPosition,
- using = options.using;
+ using;
if ( options.my[ 0 ] === "right" ) {
position.left -= elemWidth;
@@ -221,9 +221,9 @@ $.fn.position = function( options ) {
elem.bgiframe();
}
- if ( using ) {
- // we have to proxy, as jQuery.offset.setOffset throws away props other than left/top
- options.using = function( props ) {
+ if ( options.using ) {
+ // adds feedback as second argument to using callback, if present
+ using = function( props ) {
var left = targetOffset.left - props.left,
right = (targetOffset.left + targetWidth) - (props.left + elemWidth),
top = targetOffset.top - props.top,
@@ -237,11 +237,11 @@ $.fn.position = function( options ) {
} else {
feedback.important = "vertical";
}
- using.call( this, props, feedback );
+ options.using.call( this, props, feedback );
};
}
- elem.offset( $.extend( position, { using: options.using } ) );
+ elem.offset( $.extend( position, { using: using } ) );
});
};