@@ -17,72 +17,9 @@ if ( $.ui.version ) {
17
17
return ;
18
18
}
19
19
20
- //Helper functions and ui object
21
20
$ . extend ( $ . ui , {
22
21
version : "@VERSION" ,
23
22
24
- // $.ui.plugin is deprecated. Use the proxy pattern instead.
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 ] ] ) ;
31
- }
32
- } ,
33
- call : function ( instance , name , args ) {
34
- var set = instance . plugins [ name ] ;
35
- if ( ! set || ! instance . element [ 0 ] . parentNode ) {
36
- return ;
37
- }
38
-
39
- for ( var i = 0 ; i < set . length ; i ++ ) {
40
- if ( instance . options [ set [ i ] [ 0 ] ] ) {
41
- set [ i ] [ 1 ] . apply ( instance . element , args ) ;
42
- }
43
- }
44
- }
45
- } ,
46
-
47
- contains : function ( a , b ) {
48
- return document . compareDocumentPosition ?
49
- a . compareDocumentPosition ( b ) & 16 :
50
- a !== b && a . contains ( b ) ;
51
- } ,
52
-
53
- hasScroll : function ( el , a ) {
54
-
55
- //If overflow is hidden, the element might have extra content, but the user wants to hide it
56
- if ( $ ( el ) . css ( "overflow" ) === "hidden" ) {
57
- return false ;
58
- }
59
-
60
- var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop" ,
61
- has = false ;
62
-
63
- if ( el [ scroll ] > 0 ) {
64
- return true ;
65
- }
66
-
67
- // TODO: determine which cases actually cause this to happen
68
- // if the element doesn't have the scroll set, see if it's possible to
69
- // set the scroll
70
- el [ scroll ] = 1 ;
71
- has = ( el [ scroll ] > 0 ) ;
72
- el [ scroll ] = 0 ;
73
- return has ;
74
- } ,
75
-
76
- isOverAxis : function ( x , reference , size ) {
77
- //Determines when x coordinate is over "b" element axis
78
- return ( x > reference ) && ( x < ( reference + size ) ) ;
79
- } ,
80
-
81
- isOver : function ( y , x , top , left , height , width ) {
82
- //Determines when x, y coordinates is over "b" element
83
- return $ . ui . isOverAxis ( y , top , height ) && $ . ui . isOverAxis ( x , left , width ) ;
84
- } ,
85
-
86
23
keyCode : {
87
24
ALT : 18 ,
88
25
BACKSPACE : 8 ,
@@ -278,4 +215,74 @@ $.extend( $.expr[ ":" ], {
278
215
}
279
216
} ) ;
280
217
218
+
219
+
220
+
221
+
222
+ $ . extend ( $ . ui , {
223
+ // $.ui.plugin is deprecated. Use the proxy pattern instead.
224
+ plugin : {
225
+ add : function ( module , option , set ) {
226
+ var proto = $ . ui [ module ] . prototype ;
227
+ for ( var i in set ) {
228
+ proto . plugins [ i ] = proto . plugins [ i ] || [ ] ;
229
+ proto . plugins [ i ] . push ( [ option , set [ i ] ] ) ;
230
+ }
231
+ } ,
232
+ call : function ( instance , name , args ) {
233
+ var set = instance . plugins [ name ] ;
234
+ if ( ! set || ! instance . element [ 0 ] . parentNode ) {
235
+ return ;
236
+ }
237
+
238
+ for ( var i = 0 ; i < set . length ; i ++ ) {
239
+ if ( instance . options [ set [ i ] [ 0 ] ] ) {
240
+ set [ i ] [ 1 ] . apply ( instance . element , args ) ;
241
+ }
242
+ }
243
+ }
244
+ } ,
245
+
246
+ // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
247
+ contains : function ( a , b ) {
248
+ return document . compareDocumentPosition ?
249
+ a . compareDocumentPosition ( b ) & 16 :
250
+ a !== b && a . contains ( b ) ;
251
+ } ,
252
+
253
+ // only used by resizable
254
+ hasScroll : function ( el , a ) {
255
+
256
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
257
+ if ( $ ( el ) . css ( "overflow" ) === "hidden" ) {
258
+ return false ;
259
+ }
260
+
261
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop" ,
262
+ has = false ;
263
+
264
+ if ( el [ scroll ] > 0 ) {
265
+ return true ;
266
+ }
267
+
268
+ // TODO: determine which cases actually cause this to happen
269
+ // if the element doesn't have the scroll set, see if it's possible to
270
+ // set the scroll
271
+ el [ scroll ] = 1 ;
272
+ has = ( el [ scroll ] > 0 ) ;
273
+ el [ scroll ] = 0 ;
274
+ return has ;
275
+ } ,
276
+
277
+ // these are odd functions, fix the API or move into individual plugins
278
+ isOverAxis : function ( x , reference , size ) {
279
+ //Determines when x coordinate is over "b" element axis
280
+ return ( x > reference ) && ( x < ( reference + size ) ) ;
281
+ } ,
282
+ isOver : function ( y , x , top , left , height , width ) {
283
+ //Determines when x, y coordinates is over "b" element
284
+ return $ . ui . isOverAxis ( y , top , height ) && $ . ui . isOverAxis ( x , left , width ) ;
285
+ }
286
+ } ) ;
287
+
281
288
} ) ( jQuery ) ;
0 commit comments