15
15
//>>docs: http://api.jqueryui.com/position/
16
16
//>>demos: http://jqueryui.com/position/
17
17
18
- ( function ( factory ) {
18
+ ( function ( factory ) {
19
19
if ( typeof define === "function" && define . amd ) {
20
20
21
21
// AMD. Register as an anonymous module.
25
25
// Browser globals
26
26
factory ( jQuery ) ;
27
27
}
28
- } ( function ( $ ) {
29
- ( function ( ) {
28
+ } ( function ( $ ) {
29
+ ( function ( ) {
30
30
31
31
$ . ui = $ . ui || { } ;
32
32
@@ -53,7 +53,7 @@ function parseCss( element, property ) {
53
53
}
54
54
55
55
function getDimensions ( elem ) {
56
- var raw = elem [ 0 ] ;
56
+ var raw = elem [ 0 ] ;
57
57
if ( raw . nodeType === 9 ) {
58
58
return {
59
59
width : elem . width ( ) ,
@@ -89,7 +89,7 @@ $.position = {
89
89
}
90
90
var w1 , w2 ,
91
91
div = $ ( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ) ,
92
- innerDiv = div . children ( ) [ 0 ] ;
92
+ innerDiv = div . children ( ) [ 0 ] ;
93
93
94
94
$ ( "body" ) . append ( div ) ;
95
95
w1 = innerDiv . offsetWidth ;
@@ -98,30 +98,30 @@ $.position = {
98
98
w2 = innerDiv . offsetWidth ;
99
99
100
100
if ( w1 === w2 ) {
101
- w2 = div [ 0 ] . clientWidth ;
101
+ w2 = div [ 0 ] . clientWidth ;
102
102
}
103
103
104
104
div . remove ( ) ;
105
105
106
- return ( cachedScrollbarWidth = w1 - w2 ) ;
106
+ return ( cachedScrollbarWidth = w1 - w2 ) ;
107
107
} ,
108
108
getScrollInfo : function ( within ) {
109
109
var overflowX = within . isWindow || within . isDocument ? "" :
110
110
within . element . css ( "overflow-x" ) ,
111
111
overflowY = within . isWindow || within . isDocument ? "" :
112
112
within . element . css ( "overflow-y" ) ,
113
113
hasOverflowX = overflowX === "scroll" ||
114
- ( overflowX === "auto" && within . width < within . element [ 0 ] . scrollWidth ) ,
114
+ ( overflowX === "auto" && within . width < within . element [ 0 ] . scrollWidth ) ,
115
115
hasOverflowY = overflowY === "scroll" ||
116
- ( overflowY === "auto" && within . height < within . element [ 0 ] . scrollHeight ) ;
116
+ ( overflowY === "auto" && within . height < within . element [ 0 ] . scrollHeight ) ;
117
117
return {
118
118
width : hasOverflowY ? $ . position . scrollbarWidth ( ) : 0 ,
119
119
height : hasOverflowX ? $ . position . scrollbarWidth ( ) : 0
120
120
} ;
121
121
} ,
122
122
getWithinInfo : function ( element ) {
123
123
var withinElement = $ ( element || window ) ,
124
- isWindow = $ . isWindow ( withinElement [ 0 ] ) ,
124
+ isWindow = $ . isWindow ( withinElement [ 0 ] ) ,
125
125
isDocument = ! ! withinElement [ 0 ] && withinElement [ 0 ] . nodeType === 9 ;
126
126
return {
127
127
element : withinElement ,
@@ -152,7 +152,7 @@ $.fn.position = function( options ) {
152
152
offsets = { } ;
153
153
154
154
dimensions = getDimensions ( target ) ;
155
- if ( target [ 0 ] . preventDefault ) {
155
+ if ( target [ 0 ] . preventDefault ) {
156
156
// force left top to allow flipping
157
157
options . at = "left top" ;
158
158
}
@@ -169,7 +169,7 @@ $.fn.position = function( options ) {
169
169
horizontalOffset ,
170
170
verticalOffset ;
171
171
172
- if ( pos . length === 1 ) {
172
+ if ( pos . length === 1 ) {
173
173
pos = rhorizontal . test ( pos [ 0 ] ) ?
174
174
pos . concat ( [ "center" ] ) :
175
175
rvertical . test ( pos [ 0 ] ) ?
@@ -192,7 +192,7 @@ $.fn.position = function( options ) {
192
192
rposition . exec ( pos [ 0 ] ) [ 0 ] ,
193
193
rposition . exec ( pos [ 1 ] ) [ 0 ]
194
194
] ;
195
- } ) ;
195
+ } ) ;
196
196
197
197
// normalize collision option
198
198
if ( collision . length === 1 ) {
@@ -215,7 +215,7 @@ $.fn.position = function( options ) {
215
215
basePosition . left += atOffset [ 0 ] ;
216
216
basePosition . top += atOffset [ 1 ] ;
217
217
218
- return this . each ( function ( ) {
218
+ return this . each ( function ( ) {
219
219
var collisionPosition , using ,
220
220
elem = $ ( this ) ,
221
221
elemWidth = elem . outerWidth ( ) ,
@@ -268,9 +268,9 @@ $.fn.position = function( options ) {
268
268
at : options . at ,
269
269
within : within ,
270
270
elem : elem
271
- } ) ;
271
+ } ) ;
272
272
}
273
- } ) ;
273
+ } ) ;
274
274
275
275
if ( options . using ) {
276
276
// adds feedback as second argument to using callback, if present
@@ -313,7 +313,7 @@ $.fn.position = function( options ) {
313
313
}
314
314
315
315
elem . offset ( $ . extend ( position , { using : using } ) ) ;
316
- } ) ;
316
+ } ) ;
317
317
} ;
318
318
319
319
$ . ui . position = {
@@ -476,7 +476,7 @@ $.ui.position = {
476
476
} ;
477
477
478
478
// fraction support test
479
- ( function ( ) {
479
+ ( function ( ) {
480
480
var testElement , testElementParent , testElementStyle , offsetLeft , i ,
481
481
body = document . getElementsByTagName ( "body" ) [ 0 ] ,
482
482
div = document . createElement ( "div" ) ;
@@ -496,7 +496,7 @@ $.ui.position = {
496
496
position : "absolute" ,
497
497
left : "-1000px" ,
498
498
top : "-1000px"
499
- } ) ;
499
+ } ) ;
500
500
}
501
501
for ( i in testElementStyle ) {
502
502
testElement . style [ i ] = testElementStyle [ i ] ;
@@ -512,10 +512,10 @@ $.ui.position = {
512
512
513
513
testElement . innerHTML = "" ;
514
514
testElementParent . removeChild ( testElement ) ;
515
- } ) ( ) ;
515
+ } ) ( ) ;
516
516
517
- } ) ( ) ;
517
+ } ) ( ) ;
518
518
519
519
return $ . ui . position ;
520
520
521
- } ) ) ;
521
+ } ) ) ;
0 commit comments