File tree 4 files changed +50
-46
lines changed
4 files changed +50
-46
lines changed Original file line number Diff line number Diff line change @@ -4,34 +4,6 @@ module( "core - jQuery extensions" );
4
4
5
5
TestHelpers . testJshint ( "core" ) ;
6
6
7
- asyncTest ( "focus - original functionality" , function ( ) {
8
- expect ( 1 ) ;
9
- $ ( "#inputTabindex0" )
10
- . one ( "focus" , function ( ) {
11
- ok ( true , "event triggered" ) ;
12
- start ( ) ;
13
- } )
14
- . focus ( ) ;
15
- } ) ;
16
-
17
- asyncTest ( "focus" , function ( ) {
18
- expect ( 2 ) ;
19
-
20
- // support: IE 8
21
- // IE sometimes gets confused about what's focused if we don't explicitly
22
- // focus a different element first
23
- $ ( "body" ) . focus ( ) ;
24
-
25
- $ ( "#inputTabindex0" )
26
- . one ( "focus" , function ( ) {
27
- ok ( true , "event triggered" ) ;
28
- start ( ) ;
29
- } )
30
- . focus ( 500 , function ( ) {
31
- ok ( true , "callback triggered" ) ;
32
- } ) ;
33
- } ) ;
34
-
35
7
test ( "innerWidth - getter" , function ( ) {
36
8
expect ( 2 ) ;
37
9
var el = $ ( "#dimensions" ) ;
Original file line number Diff line number Diff line change 2
2
3
3
module ( "core - deprecated" ) ;
4
4
5
+ asyncTest ( "focus - original functionality" , function ( ) {
6
+ expect ( 1 ) ;
7
+ $ ( "#inputTabindex0" )
8
+ . one ( "focus" , function ( ) {
9
+ ok ( true , "event triggered" ) ;
10
+ start ( ) ;
11
+ } )
12
+ . focus ( ) ;
13
+ } ) ;
14
+
15
+ asyncTest ( "focus" , function ( ) {
16
+ expect ( 2 ) ;
17
+
18
+ // support: IE 8
19
+ // IE sometimes gets confused about what's focused if we don't explicitly
20
+ // focus a different element first
21
+ $ ( "body" ) . focus ( ) ;
22
+
23
+ $ ( "#inputTabindex0" )
24
+ . one ( "focus" , function ( ) {
25
+ ok ( true , "event triggered" ) ;
26
+ start ( ) ;
27
+ } )
28
+ . focus ( 500 , function ( ) {
29
+ ok ( true , "callback triggered" ) ;
30
+ } ) ;
31
+ } ) ;
32
+
5
33
test ( "zIndex" , function ( ) {
6
34
expect ( 7 ) ;
7
35
var el = $ ( "#zIndexAutoWithParent" ) ,
Original file line number Diff line number Diff line change @@ -48,22 +48,6 @@ $.extend( $.ui, {
48
48
49
49
// plugins
50
50
$ . fn . extend ( {
51
- focus : ( function ( orig ) {
52
- return function ( delay , fn ) {
53
- return typeof delay === "number" ?
54
- this . each ( function ( ) {
55
- var elem = this ;
56
- setTimeout ( function ( ) {
57
- $ ( elem ) . focus ( ) ;
58
- if ( fn ) {
59
- fn . call ( elem ) ;
60
- }
61
- } , delay ) ;
62
- } ) :
63
- orig . apply ( this , arguments ) ;
64
- } ;
65
- } ) ( $ . fn . focus ) ,
66
-
67
51
scrollParent : function ( ) {
68
52
var position = this . css ( "position" ) ,
69
53
excludeStaticParent = position === "absolute" ,
@@ -225,6 +209,22 @@ $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
225
209
226
210
$ . support . selectstart = "onselectstart" in document . createElement ( "div" ) ;
227
211
$ . fn . extend ( {
212
+ focus : ( function ( orig ) {
213
+ return function ( delay , fn ) {
214
+ return typeof delay === "number" ?
215
+ this . each ( function ( ) {
216
+ var elem = this ;
217
+ setTimeout ( function ( ) {
218
+ $ ( elem ) . focus ( ) ;
219
+ if ( fn ) {
220
+ fn . call ( elem ) ;
221
+ }
222
+ } , delay ) ;
223
+ } ) :
224
+ orig . apply ( this , arguments ) ;
225
+ } ;
226
+ } ) ( $ . fn . focus ) ,
227
+
228
228
disableSelection : function ( ) {
229
229
return this . bind ( ( $ . support . selectstart ? "selectstart" : "mousedown" ) +
230
230
".ui-disableSelection" , function ( event ) {
Original file line number Diff line number Diff line change @@ -342,10 +342,14 @@ return $.widget( "ui.dialog", {
342
342
last = tabbables . filter ( ":last" ) ;
343
343
344
344
if ( ( event . target === last [ 0 ] || event . target === this . uiDialog [ 0 ] ) && ! event . shiftKey ) {
345
- first . focus ( 1 ) ;
345
+ this . _delay ( function ( ) {
346
+ first . focus ( ) ;
347
+ } ) ;
346
348
event . preventDefault ( ) ;
347
349
} else if ( ( event . target === first [ 0 ] || event . target === this . uiDialog [ 0 ] ) && event . shiftKey ) {
348
- last . focus ( 1 ) ;
350
+ this . _delay ( function ( ) {
351
+ first . focus ( ) ;
352
+ } ) ;
349
353
event . preventDefault ( ) ;
350
354
}
351
355
} ,
You can’t perform that action at this time.
0 commit comments