@@ -2567,35 +2567,35 @@ test( "make sure events cloned correctly", 18, function() {
2567
2567
clone . find ( "#check1" ) . trigger ( "change" ) ; // 0 events should fire
2568
2568
} ) ;
2569
2569
2570
- asyncTest ( "Check order of focusin/focusout events" , 2 , function ( ) {
2571
- var focus , blur ,
2572
- input = jQuery ( "#name" ) ;
2570
+ // This test fails in some browsers if document does not have focus
2571
+ if ( ! document . hasFocus || document . hasFocus && document . hasFocus ( ) ) {
2572
+ test ( "Check order of focusin/focusout events" , 2 , function ( ) {
2573
+ var focus , blur ,
2574
+ input = jQuery ( "#name" ) ;
2573
2575
2574
- input . on ( "focus" , function ( ) {
2575
- focus = true ;
2576
+ input . on ( "focus" , function ( ) {
2577
+ focus = true ;
2576
2578
2577
- } ) . on ( "focusin" , function ( ) {
2578
- ok ( ! focus , "Focusin event should fire before focus does" ) ;
2579
+ } ) . on ( "focusin" , function ( ) {
2580
+ ok ( ! focus , "Focusin event should fire before focus does" ) ;
2579
2581
2580
- } ) . on ( "blur" , function ( ) {
2581
- blur = true ;
2582
+ } ) . on ( "blur" , function ( ) {
2583
+ blur = true ;
2582
2584
2583
- } ) . on ( "focusout" , function ( ) {
2584
- ok ( ! blur , "Focusout event should fire before blur does" ) ;
2585
- } ) ;
2585
+ } ) . on ( "focusout" , function ( ) {
2586
+ ok ( ! blur , "Focusout event should fire before blur does" ) ;
2587
+ } ) ;
2586
2588
2587
- // gain focus
2588
- input . trigger ( "focus" ) ;
2589
+ // gain focus
2590
+ input . trigger ( "focus" ) ;
2589
2591
2590
- // then lose it
2591
- jQuery ( "#search" ) . trigger ( "focus" ) ;
2592
+ // then lose it
2593
+ jQuery ( "#search" ) . trigger ( "focus" ) ;
2592
2594
2593
- // cleanup
2594
- setTimeout ( function ( ) {
2595
+ // cleanup
2595
2596
input . off ( ) ;
2596
- start ( ) ;
2597
- } , 50 ) ;
2598
- } ) ;
2597
+ } ) ;
2598
+ }
2599
2599
2600
2600
test ( "String.prototype.namespace does not cause trigger() to throw (#13360)" , function ( ) {
2601
2601
expect ( 1 ) ;
0 commit comments