Skip to content

Commit

Permalink
Fixes #12518, removes an offsetWidth on focus/blur events for an <IE9…
Browse files Browse the repository at this point in the history
… bug that caused a performance hit. Closes gh-958
  • Loading branch information
Merrifield, Jay authored and mikesherov committed Oct 20, 2012
1 parent a7a8aad commit 408e5e0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/event.js
Expand Up @@ -327,8 +327,7 @@ jQuery.event = {
// Call a native DOM method on the target with the same name name as the 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. // 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) // Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {


// Don't re-trigger an onFOO event when we call its FOO() method // Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ]; old = elem[ ontype ];
Expand All @@ -339,7 +338,12 @@ jQuery.event = {


// Prevent re-triggering of the same event, since we already bubbled it above // Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type; jQuery.event.triggered = type;
elem[ type ](); try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;


if ( old ) { if ( old ) {
Expand Down

0 comments on commit 408e5e0

Please sign in to comment.