0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Fix blur() function loses IE browser window focus.

This commit is contained in:
Neil Jenkins 2012-08-09 15:44:12 +10:00
parent f9974ed7d9
commit 691058e071
2 changed files with 10 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
/* Copyright © 2011-2012 by Neil Jenkins. Licensed under the MIT license. */ /* Copyright © 2011-2012 by Neil Jenkins. Licensed under the MIT license. */
/*global Range, navigator, window, document, setTimeout */ /*global Range, navigator, top, window, document, setTimeout */
( function ( doc ) { ( function ( doc ) {
@ -263,7 +263,14 @@
}; };
var blur = function () { var blur = function () {
body.blur(); // IE will remove the whole browser window from focus if you call
// win.blur() or body.blur(), so instead we call top.focus() to focus
// the top frame, thus blurring this frame. This works in everything
// except FF, so we need to call body.blur() in that as well.
if ( isGecko ) {
body.blur();
}
top.focus();
}; };
win.addEventListener( 'focus', propagateEvent, false ); win.addEventListener( 'focus', propagateEvent, false );