aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/ui/jquery.ui.position.js
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/js/ui/jquery.ui.position.js')
-rw-r--r--themes/default/js/ui/jquery.ui.position.js104
1 files changed, 42 insertions, 62 deletions
diff --git a/themes/default/js/ui/jquery.ui.position.js b/themes/default/js/ui/jquery.ui.position.js
index 3184a53eb..6e4829a92 100644
--- a/themes/default/js/ui/jquery.ui.position.js
+++ b/themes/default/js/ui/jquery.ui.position.js
@@ -1,8 +1,8 @@
/*!
- * jQuery UI Position 1.9.0
+ * jQuery UI Position 1.10.1
* http://jqueryui.com
*
- * Copyright 2012 jQuery Foundation and other contributors
+ * Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -18,21 +18,52 @@ var cachedScrollbarWidth,
round = Math.round,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
- roffset = /[\+\-]\d+%?/,
+ roffset = /[\+\-]\d+(\.[\d]+)?%?/,
rposition = /^\w+/,
rpercent = /%$/,
_position = $.fn.position;
function getOffsets( offsets, width, height ) {
return [
- parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
- parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+ parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+ parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
];
}
+
function parseCss( element, property ) {
return parseInt( $.css( element, property ), 10 ) || 0;
}
+function getDimensions( elem ) {
+ var raw = elem[0];
+ if ( raw.nodeType === 9 ) {
+ return {
+ width: elem.width(),
+ height: elem.height(),
+ offset: { top: 0, left: 0 }
+ };
+ }
+ if ( $.isWindow( raw ) ) {
+ return {
+ width: elem.width(),
+ height: elem.height(),
+ offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
+ };
+ }
+ if ( raw.preventDefault ) {
+ return {
+ width: 0,
+ height: 0,
+ offset: { top: raw.pageY, left: raw.pageX }
+ };
+ }
+ return {
+ width: elem.outerWidth(),
+ height: elem.outerHeight(),
+ offset: elem.offset()
+ };
+}
+
$.position = {
scrollbarWidth: function() {
if ( cachedScrollbarWidth !== undefined ) {
@@ -91,32 +122,21 @@ $.fn.position = function( options ) {
// make a copy, we don't want to modify arguments
options = $.extend( {}, options );
- var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
+ var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
target = $( options.of ),
within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
- targetElem = target[0],
collision = ( options.collision || "flip" ).split( " " ),
offsets = {};
- if ( targetElem.nodeType === 9 ) {
- targetWidth = target.width();
- targetHeight = target.height();
- targetOffset = { top: 0, left: 0 };
- } else if ( $.isWindow( targetElem ) ) {
- targetWidth = target.width();
- targetHeight = target.height();
- targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
- } else if ( targetElem.preventDefault ) {
+ dimensions = getDimensions( target );
+ if ( target[0].preventDefault ) {
// force left top to allow flipping
options.at = "left top";
- targetWidth = targetHeight = 0;
- targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
- } else {
- targetWidth = target.outerWidth();
- targetHeight = target.outerHeight();
- targetOffset = target.offset();
}
+ targetWidth = dimensions.width;
+ targetHeight = dimensions.height;
+ targetOffset = dimensions.offset;
// clone to reuse original targetOffset later
basePosition = $.extend( {}, targetOffset );
@@ -230,10 +250,6 @@ $.fn.position = function( options ) {
}
});
- if ( $.fn.bgiframe ) {
- elem.bgiframe();
- }
-
if ( options.using ) {
// adds feedback as second argument to using callback, if present
using = function( props ) {
@@ -478,40 +494,4 @@ $.ui.position = {
testElementParent.removeChild( testElement );
})();
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
- // offset option
- (function( $ ) {
- var _position = $.fn.position;
- $.fn.position = function( options ) {
- if ( !options || !options.offset ) {
- return _position.call( this, options );
- }
- var offset = options.offset.split( " " ),
- at = options.at.split( " " );
- if ( offset.length === 1 ) {
- offset[ 1 ] = offset[ 0 ];
- }
- if ( /^\d/.test( offset[ 0 ] ) ) {
- offset[ 0 ] = "+" + offset[ 0 ];
- }
- if ( /^\d/.test( offset[ 1 ] ) ) {
- offset[ 1 ] = "+" + offset[ 1 ];
- }
- if ( at.length === 1 ) {
- if ( /left|center|right/.test( at[ 0 ] ) ) {
- at[ 1 ] = "center";
- } else {
- at[ 1 ] = at[ 0 ];
- at[ 0 ] = "center";
- }
- }
- return _position.call( this, $.extend( options, {
- at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
- offset: undefined
- } ) );
- };
- }( jQuery ) );
-}
-
}( jQuery ) );