jQuery.event.special[ fix ] = {
setup: function() {
- var doc = this.ownerDocument,
+ var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix );
if ( !attaches ) {
jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
},
teardown: function() {
- var doc = this.ownerDocument,
+ var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix ) - 1;
if ( !attaches ) {
jQuery.event.fixHooks.click = saved;
});
+test( "focusin using non-element targets", function() {
+ expect( 2 );
+
+ jQuery( document ).on( "focusin", function( e ) {
+ ok( e.type === "focusin", "got a focusin event on a document" );
+ }).trigger( "focusin" ).off( "focusin" );
+
+ jQuery( window ).on( "focusin", function( e ) {
+ ok( e.type === "focusin", "got a focusin event on a window" );
+ }).trigger( "focusin" ).off( "focusin" );
+
+});
+
testIframeWithCallback( "focusin from an iframe", "event/focusinCrossFrame.html", function( frameDoc ) {
expect(1);