Skip to content

Commit

Permalink
Fix #6170. Don't try to run DOM methods on window.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmethvin authored and timmywil committed Sep 19, 2011
1 parent 38601e0 commit 6872d31
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/event.js
Expand Up @@ -386,24 +386,25 @@ jQuery.event = {

// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction)() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus to hidden element (#1486)
if ( ontype && elem[ type ] && elem.offsetWidth !== 0 ) {
if ( ontype && elem[ type ] && elem.offsetWidth !== 0 && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];

if ( old ) {
elem[ ontype ] = null;
}

// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;

if ( old ) {
elem[ ontype ] = old;
}
}

jQuery.event.triggered = undefined;
}
}

Expand Down

0 comments on commit 6872d31

Please sign in to comment.