]> source.dussan.org Git - jquery-ui.git/commitdiff
Position: Fix style issues
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 14 Mar 2015 11:33:03 +0000 (12:33 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 18 Mar 2015 11:34:46 +0000 (12:34 +0100)
Closes gh-1499

ui/position.js

index 1ef4d4c5bd94f0968b9cd55302a5278cea139862..7423d02d17e1772f9aedcbf04214b6e57805f921 100644 (file)
@@ -15,7 +15,7 @@
 //>>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.
@@ -25,8 +25,8 @@
                // Browser globals
                factory( jQuery );
        }
-}(function( $ ) {
-(function() {
+}( function( $ ) {
+( function() {
 
 $.ui = $.ui || {};
 
@@ -53,7 +53,7 @@ function parseCss( element, property ) {
 }
 
 function getDimensions( elem ) {
-       var raw = elem[0];
+       var raw = elem[ 0 ];
        if ( raw.nodeType === 9 ) {
                return {
                        width: elem.width(),
@@ -89,7 +89,7 @@ $.position = {
                }
                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;
@@ -98,12 +98,12 @@ $.position = {
                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 ? "" :
@@ -111,9 +111,9 @@ $.position = {
                        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
@@ -121,7 +121,7 @@ $.position = {
        },
        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,
@@ -152,7 +152,7 @@ $.fn.position = function( options ) {
                offsets = {};
 
        dimensions = getDimensions( target );
-       if ( target[0].preventDefault ) {
+       if ( target[ 0 ].preventDefault ) {
                // force left top to allow flipping
                options.at = "left top";
        }
@@ -169,7 +169,7 @@ $.fn.position = function( options ) {
                        horizontalOffset,
                        verticalOffset;
 
-               if ( pos.length === 1) {
+               if ( pos.length === 1 ) {
                        pos = rhorizontal.test( pos[ 0 ] ) ?
                                pos.concat( [ "center" ] ) :
                                rvertical.test( pos[ 0 ] ) ?
@@ -192,7 +192,7 @@ $.fn.position = function( options ) {
                        rposition.exec( pos[ 0 ] )[ 0 ],
                        rposition.exec( pos[ 1 ] )[ 0 ]
                ];
-       });
+       } );
 
        // normalize collision option
        if ( collision.length === 1 ) {
@@ -215,7 +215,7 @@ $.fn.position = function( options ) {
        basePosition.left += atOffset[ 0 ];
        basePosition.top += atOffset[ 1 ];
 
-       return this.each(function() {
+       return this.each( function() {
                var collisionPosition, using,
                        elem = $( this ),
                        elemWidth = elem.outerWidth(),
@@ -268,9 +268,9 @@ $.fn.position = function( options ) {
                                        at: options.at,
                                        within: within,
                                        elem: elem
-                               });
+                               } );
                        }
-               });
+               } );
 
                if ( options.using ) {
                        // adds feedback as second argument to using callback, if present
@@ -313,7 +313,7 @@ $.fn.position = function( options ) {
                }
 
                elem.offset( $.extend( position, { using: using } ) );
-       });
+       } );
 };
 
 $.ui.position = {
@@ -476,7 +476,7 @@ $.ui.position = {
 };
 
 // fraction support test
-(function() {
+( function() {
        var testElement, testElementParent, testElementStyle, offsetLeft, i,
                body = document.getElementsByTagName( "body" )[ 0 ],
                div = document.createElement( "div" );
@@ -496,7 +496,7 @@ $.ui.position = {
                        position: "absolute",
                        left: "-1000px",
                        top: "-1000px"
-               });
+               } );
        }
        for ( i in testElementStyle ) {
                testElement.style[ i ] = testElementStyle[ i ];
@@ -512,10 +512,10 @@ $.ui.position = {
 
        testElement.innerHTML = "";
        testElementParent.removeChild( testElement );
-})();
+} )();
 
-})();
+} )();
 
 return $.ui.position;
 
-}));
+} ) );