//>>docs: http://api.jqueryui.com/position/
//>>demos: http://jqueryui.com/position/
-(function( factory ) {
+( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
// Browser globals
factory( jQuery );
}
-}(function( $ ) {
-(function() {
+}( function( $ ) {
+( function() {
$.ui = $.ui || {};
}
function getDimensions( elem ) {
- var raw = elem[0];
+ var raw = elem[ 0 ];
if ( raw.nodeType === 9 ) {
return {
width: elem.width(),
}
var w1, w2,
div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
- innerDiv = div.children()[0];
+ innerDiv = div.children()[ 0 ];
$( "body" ).append( div );
w1 = innerDiv.offsetWidth;
w2 = innerDiv.offsetWidth;
if ( w1 === w2 ) {
- w2 = div[0].clientWidth;
+ w2 = div[ 0 ].clientWidth;
}
div.remove();
- return (cachedScrollbarWidth = w1 - w2);
+ return ( cachedScrollbarWidth = w1 - w2 );
},
getScrollInfo: function( within ) {
var overflowX = within.isWindow || within.isDocument ? "" :
overflowY = within.isWindow || within.isDocument ? "" :
within.element.css( "overflow-y" ),
hasOverflowX = overflowX === "scroll" ||
- ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+ ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
hasOverflowY = overflowY === "scroll" ||
- ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+ ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
return {
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
height: hasOverflowX ? $.position.scrollbarWidth() : 0
},
getWithinInfo: function( element ) {
var withinElement = $( element || window ),
- isWindow = $.isWindow( withinElement[0] ),
+ isWindow = $.isWindow( withinElement[ 0 ] ),
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
return {
element: withinElement,
offsets = {};
dimensions = getDimensions( target );
- if ( target[0].preventDefault ) {
+ if ( target[ 0 ].preventDefault ) {
// force left top to allow flipping
options.at = "left top";
}
horizontalOffset,
verticalOffset;
- if ( pos.length === 1) {
+ if ( pos.length === 1 ) {
pos = rhorizontal.test( pos[ 0 ] ) ?
pos.concat( [ "center" ] ) :
rvertical.test( pos[ 0 ] ) ?
rposition.exec( pos[ 0 ] )[ 0 ],
rposition.exec( pos[ 1 ] )[ 0 ]
];
- });
+ } );
// normalize collision option
if ( collision.length === 1 ) {
basePosition.left += atOffset[ 0 ];
basePosition.top += atOffset[ 1 ];
- return this.each(function() {
+ return this.each( function() {
var collisionPosition, using,
elem = $( this ),
elemWidth = elem.outerWidth(),
at: options.at,
within: within,
elem: elem
- });
+ } );
}
- });
+ } );
if ( options.using ) {
// adds feedback as second argument to using callback, if present
}
elem.offset( $.extend( position, { using: using } ) );
- });
+ } );
};
$.ui.position = {
};
// fraction support test
-(function() {
+( function() {
var testElement, testElementParent, testElementStyle, offsetLeft, i,
body = document.getElementsByTagName( "body" )[ 0 ],
div = document.createElement( "div" );
position: "absolute",
left: "-1000px",
top: "-1000px"
- });
+ } );
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
-})();
+} )();
-})();
+} )();
return $.ui.position;
-}));
+} ) );