13
13
// this is only a problem because we proxy existing functions
14
14
// and we don't want to double proxy them
15
15
$ . ui = $ . ui || { } ;
16
- if ( $ . ui . version ) {
16
+ if ( $ . ui . version ) {
17
17
return ;
18
18
}
19
19
20
20
//Helper functions and ui object
21
- $ . extend ( $ . ui , {
21
+ $ . extend ( $ . ui , {
22
22
version : "@VERSION" ,
23
23
24
24
// $.ui.plugin is deprecated. Use the proxy pattern instead.
25
25
plugin : {
26
- add : function ( module , option , set ) {
27
- var proto = $ . ui [ module ] . prototype ;
28
- for ( var i in set ) {
29
- proto . plugins [ i ] = proto . plugins [ i ] || [ ] ;
30
- proto . plugins [ i ] . push ( [ option , set [ i ] ] ) ;
26
+ add : function ( module , option , set ) {
27
+ var proto = $ . ui [ module ] . prototype ;
28
+ for ( var i in set ) {
29
+ proto . plugins [ i ] = proto . plugins [ i ] || [ ] ;
30
+ proto . plugins [ i ] . push ( [ option , set [ i ] ] ) ;
31
31
}
32
32
} ,
33
- call : function ( instance , name , args ) {
34
- var set = instance . plugins [ name ] ;
35
- if ( ! set || ! instance . element [ 0 ] . parentNode ) { return ; }
33
+ call : function ( instance , name , args ) {
34
+ var set = instance . plugins [ name ] ;
35
+ if ( ! set || ! instance . element [ 0 ] . parentNode ) {
36
+ return ;
37
+ }
36
38
37
- for ( var i = 0 ; i < set . length ; i ++ ) {
38
- if ( instance . options [ set [ i ] [ 0 ] ] ) {
39
- set [ i ] [ 1 ] . apply ( instance . element , args ) ;
39
+ for ( var i = 0 ; i < set . length ; i ++ ) {
40
+ if ( instance . options [ set [ i ] [ 0 ] ] ) {
41
+ set [ i ] [ 1 ] . apply ( instance . element , args ) ;
40
42
}
41
43
}
42
44
}
43
45
} ,
44
46
45
- contains : function ( a , b ) {
46
- return document . compareDocumentPosition
47
- ? a . compareDocumentPosition ( b ) & 16
48
- : a !== b && a . contains ( b ) ;
47
+ contains : function ( a , b ) {
48
+ return document . compareDocumentPosition ?
49
+ a . compareDocumentPosition ( b ) & 16 :
50
+ a !== b && a . contains ( b ) ;
49
51
} ,
50
52
51
- hasScroll : function ( el , a ) {
53
+ hasScroll : function ( el , a ) {
52
54
53
55
//If overflow is hidden, the element might have extra content, but the user wants to hide it
54
- if ( $ ( el ) . css ( 'overflow' ) == 'hidden' ) { return false ; }
56
+ if ( $ ( el ) . css ( "overflow" ) === "hidden" ) {
57
+ return false ;
58
+ }
55
59
56
- var scroll = ( a && a == ' left' ) ? ' scrollLeft' : ' scrollTop' ,
60
+ var scroll = ( a && a === " left" ) ? " scrollLeft" : " scrollTop" ,
57
61
has = false ;
58
62
59
- if ( el [ scroll ] > 0 ) { return true ; }
63
+ if ( el [ scroll ] > 0 ) {
64
+ return true ;
65
+ }
60
66
61
67
// TODO: determine which cases actually cause this to happen
62
68
// if the element doesn't have the scroll set, see if it's possible to
63
69
// set the scroll
64
- el [ scroll ] = 1 ;
65
- has = ( el [ scroll ] > 0 ) ;
66
- el [ scroll ] = 0 ;
70
+ el [ scroll ] = 1 ;
71
+ has = ( el [ scroll ] > 0 ) ;
72
+ el [ scroll ] = 0 ;
67
73
return has ;
68
74
} ,
69
75
70
- isOverAxis : function ( x , reference , size ) {
76
+ isOverAxis : function ( x , reference , size ) {
71
77
//Determines when x coordinate is over "b" element axis
72
- return ( x > reference ) && ( x < ( reference + size ) ) ;
78
+ return ( x > reference ) && ( x < ( reference + size ) ) ;
73
79
} ,
74
80
75
- isOver : function ( y , x , top , left , height , width ) {
81
+ isOver : function ( y , x , top , left , height , width ) {
76
82
//Determines when x, y coordinates is over "b" element
77
- return $ . ui . isOverAxis ( y , top , height ) && $ . ui . isOverAxis ( x , left , width ) ;
83
+ return $ . ui . isOverAxis ( y , top , height ) && $ . ui . isOverAxis ( x , left , width ) ;
78
84
} ,
79
85
80
86
keyCode : {
@@ -116,33 +122,35 @@ $.extend($.ui, {
116
122
//jQuery plugins
117
123
$ . fn . extend ( {
118
124
_focus : $ . fn . focus ,
119
- focus : function ( delay , fn ) {
120
- return typeof delay === ' number'
121
- ? this . each ( function ( ) {
125
+ focus : function ( delay , fn ) {
126
+ return typeof delay === " number" ?
127
+ this . each ( function ( ) {
122
128
var elem = this ;
123
129
setTimeout ( function ( ) {
124
- $ ( elem ) . focus ( ) ;
125
- ( fn && fn . call ( elem ) ) ;
126
- } , delay ) ;
127
- } )
128
- : this . _focus . apply ( this , arguments ) ;
130
+ $ ( elem ) . focus ( ) ;
131
+ if ( fn ) {
132
+ fn . call ( elem ) ;
133
+ }
134
+ } , delay ) ;
135
+ } ) :
136
+ this . _focus . apply ( this , arguments ) ;
129
137
} ,
130
-
138
+
131
139
enableSelection : function ( ) {
132
140
return this
133
- . attr ( ' unselectable' , ' off' )
134
- . css ( ' MozUserSelect' , '' ) ;
141
+ . attr ( " unselectable" , " off" )
142
+ . css ( " MozUserSelect" , "" ) ;
135
143
} ,
136
144
137
145
disableSelection : function ( ) {
138
146
return this
139
- . attr ( ' unselectable' , 'on' )
140
- . css ( ' MozUserSelect' , ' none' ) ;
147
+ . attr ( " unselectable" , "on" )
148
+ . css ( " MozUserSelect" , " none" ) ;
141
149
} ,
142
150
143
151
scrollParent : function ( ) {
144
152
var scrollParent ;
145
- if ( ( $ . browser . msie && ( / ( s t a t i c | r e l a t i v e ) / ) . test ( this . css ( 'position' ) ) ) || ( / a b s o l u t e / ) . test ( this . css ( 'position' ) ) ) {
153
+ if ( ( $ . browser . msie && ( / ( s t a t i c | r e l a t i v e ) / ) . test ( this . css ( 'position' ) ) ) || ( / a b s o l u t e / ) . test ( this . css ( 'position' ) ) ) {
146
154
scrollParent = this . parents ( ) . filter ( function ( ) {
147
155
return ( / ( r e l a t i v e | a b s o l u t e | f i x e d ) / ) . test ( $ . curCSS ( this , 'position' , 1 ) ) && ( / ( a u t o | s c r o l l ) / ) . test ( $ . curCSS ( this , 'overflow' , 1 ) + $ . curCSS ( this , 'overflow-y' , 1 ) + $ . curCSS ( this , 'overflow-x' , 1 ) ) ;
148
156
} ) . eq ( 0 ) ;
@@ -155,26 +163,25 @@ $.fn.extend({
155
163
return ( / f i x e d / ) . test ( this . css ( 'position' ) ) || ! scrollParent . length ? $ ( document ) : scrollParent ;
156
164
} ,
157
165
158
- zIndex : function ( zIndex ) {
159
- if ( zIndex !== undefined ) {
160
- return this . css ( ' zIndex' , zIndex ) ;
166
+ zIndex : function ( zIndex ) {
167
+ if ( zIndex !== undefined ) {
168
+ return this . css ( " zIndex" , zIndex ) ;
161
169
}
162
-
163
- if ( this . length ) {
164
- var elem = $ ( this [ 0 ] ) , position , value ;
165
- while ( elem . length && elem [ 0 ] !== document ) {
170
+
171
+ if ( this . length ) {
172
+ var elem = $ ( this [ 0 ] ) , position , value ;
173
+ while ( elem . length && elem [ 0 ] !== document ) {
166
174
// Ignore z-index if position is set to a value where z-index is ignored by the browser
167
175
// This makes behavior of this function consistent across browsers
168
176
// WebKit always returns auto if the element is positioned
169
- position = elem . css ( 'position' ) ;
170
- if ( position == 'absolute' || position == 'relative' || position == 'fixed' )
171
- {
177
+ position = elem . css ( "position" ) ;
178
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
172
179
// IE returns 0 when zIndex is not specified
173
180
// other browsers return a string
174
181
// we ignore the case of nested elements with an explicit value of 0
175
182
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
176
- value = parseInt ( elem . css ( ' zIndex' ) ) ;
177
- if ( ! isNaN ( value ) && value != 0 ) {
183
+ value = parseInt ( elem . css ( " zIndex" ) ) ;
184
+ if ( ! isNaN ( value ) && value != 0 ) {
178
185
return value ;
179
186
}
180
187
}
@@ -198,12 +205,12 @@ $.each( [ "Width", "Height" ], function( i, name ) {
198
205
199
206
function reduce ( elem , size , border , margin ) {
200
207
$ . each ( side , function ( ) {
201
- size -= parseFloat ( $ . curCSS ( elem , "padding" + this , true ) ) || 0 ;
208
+ size -= parseFloat ( $ . curCSS ( elem , "padding" + this , true ) ) || 0 ;
202
209
if ( border ) {
203
- size -= parseFloat ( $ . curCSS ( elem , "border" + this + "Width" , true ) ) || 0 ;
210
+ size -= parseFloat ( $ . curCSS ( elem , "border" + this + "Width" , true ) ) || 0 ;
204
211
}
205
212
if ( margin ) {
206
- size -= parseFloat ( $ . curCSS ( elem , "margin" + this , true ) ) || 0 ;
213
+ size -= parseFloat ( $ . curCSS ( elem , "margin" + this , true ) ) || 0 ;
207
214
}
208
215
} ) ;
209
216
return size ;
@@ -232,20 +239,20 @@ $.each( [ "Width", "Height" ], function( i, name ) {
232
239
233
240
//Additional selectors
234
241
function visible ( element ) {
235
- return ! $ ( element ) . parents ( ) . andSelf ( ) . filter ( function ( ) {
242
+ return ! $ ( element ) . parents ( ) . andSelf ( ) . filter ( function ( ) {
236
243
return $ . curCSS ( this , "visibility" ) === "hidden" ||
237
244
$ . expr . filters . hidden ( this ) ;
238
245
} ) . length ;
239
246
}
240
247
241
- $ . extend ( $ . expr [ ':' ] , {
242
- data : function ( elem , i , match ) {
243
- return ! ! $ . data ( elem , match [ 3 ] ) ;
248
+ $ . extend ( $ . expr [ ":" ] , {
249
+ data : function ( elem , i , match ) {
250
+ return ! ! $ . data ( elem , match [ 3 ] ) ;
244
251
} ,
245
252
246
- focusable : function ( element ) {
253
+ focusable : function ( element ) {
247
254
var nodeName = element . nodeName . toLowerCase ( ) ,
248
- tabIndex = $ . attr ( element , ' tabindex' ) ;
255
+ tabIndex = $ . attr ( element , " tabindex" ) ;
249
256
if ( "area" === nodeName ) {
250
257
var map = element . parentNode ,
251
258
mapName = map . name ,
@@ -256,19 +263,19 @@ $.extend($.expr[':'], {
256
263
img = $ ( "img[usemap=#" + mapName + "]" ) [ 0 ] ;
257
264
return ! ! img && visible ( img ) ;
258
265
}
259
- return ( / i n p u t | s e l e c t | t e x t a r e a | b u t t o n | o b j e c t / . test ( nodeName )
266
+ return ( / i n p u t | s e l e c t | t e x t a r e a | b u t t o n | o b j e c t / . test ( nodeName )
260
267
? ! element . disabled
261
- : 'a' == nodeName
262
- ? element . href || ! isNaN ( tabIndex )
263
- : ! isNaN ( tabIndex ) )
268
+ : "a" == nodeName
269
+ ? element . href || ! isNaN ( tabIndex )
270
+ : ! isNaN ( tabIndex ) )
264
271
// the element and all of its ancestors must be visible
265
272
&& visible ( element ) ;
266
273
} ,
267
274
268
- tabbable : function ( element ) {
269
- var tabIndex = $ . attr ( element , ' tabindex' ) ;
270
- return ( isNaN ( tabIndex ) || tabIndex >= 0 ) && $ ( element ) . is ( ' :focusable' ) ;
275
+ tabbable : function ( element ) {
276
+ var tabIndex = $ . attr ( element , " tabindex" ) ;
277
+ return ( isNaN ( tabIndex ) || tabIndex >= 0 ) && $ ( element ) . is ( " :focusable" ) ;
271
278
}
272
279
} ) ;
273
280
274
- } ) ( jQuery ) ;
281
+ } ) ( jQuery ) ;
0 commit comments