File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -194,18 +194,23 @@ $.extend( $.simulate.prototype, {
194194 element . bind ( "blur" , trigger ) ;
195195 element [ 0 ] . blur ( ) ;
196196
197- // Some versions of IE don't actually .blur() on an element - so we focus the body
198- if ( element [ 0 ] . ownerDocument . activeElement === element [ 0 ] ) {
199- element [ 0 ] . ownerDocument . body . focus ( ) ;
200- }
197+ // blur events are async in IE
198+ setTimeout ( function ( ) {
199+ // IE won't let the blur occur if the window is inactive
200+ if ( element [ 0 ] . ownerDocument . activeElement === element [ 0 ] ) {
201+ element [ 0 ] . ownerDocument . body . focus ( ) ;
202+ }
201203
202- if ( ! triggered ) {
203- focusoutEvent = $ . Event ( "focusout" ) ;
204- focusoutEvent . preventDefault ( ) ;
205- element . trigger ( focusoutEvent ) ;
206- element . triggerHandler ( "blur" ) ;
207- }
208- element . unbind ( "blur" , trigger ) ;
204+ // Firefox won't trigger events if the window is inactive
205+ // IE doesn't trigger events if we had to manually focus the body
206+ if ( ! triggered ) {
207+ focusoutEvent = $ . Event ( "focusout" ) ;
208+ focusoutEvent . preventDefault ( ) ;
209+ element . trigger ( focusoutEvent ) ;
210+ element . triggerHandler ( "blur" ) ;
211+ }
212+ element . unbind ( "blur" , trigger ) ;
213+ } , 1 ) ;
209214 }
210215} ) ;
211216
You can’t perform that action at this time.
0 commit comments