clone.find("#check1").trigger("change"); // 0 events should fire
});
-// This test fails in some browsers if document does not have focus
-if ( !document.hasFocus || document.hasFocus && document.hasFocus() ) {
- test( "Check order of focusin/focusout events", 2, function() {
- var focus, blur,
- input = jQuery( "#name" );
+test( "Check order of focusin/focusout events", 2, function() {
+ var focus, blur,
+ input = jQuery( "#name" );
- input.on( "focus", function() {
- focus = true;
+ document.body.focus();
- }).on( "focusin", function() {
- ok( !focus, "Focusin event should fire before focus does" );
+ input.on( "focus", function() {
+ focus = true;
- }).on( "blur", function() {
- blur = true;
+ }).on( "focusin", function() {
+ ok( !focus, "Focusin event should fire before focus does" );
- }).on( "focusout", function() {
- ok( !blur, "Focusout event should fire before blur does" );
- });
+ }).on( "blur", function() {
+ blur = true;
- // gain focus
- input.trigger( "focus" );
+ }).on( "focusout", function() {
+ ok( !blur, "Focusout event should fire before blur does" );
+ });
- // then lose it
- jQuery( "#search" ).trigger( "focus" );
+ // gain focus
+ input.trigger( "focus" );
- // cleanup
- input.off();
- });
-}
+ // then lose it
+ jQuery( "#search" ).trigger( "focus" );
+
+ // cleanup
+ input.off();
+});
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
expect( 1 );