From f8ccc2186fd3dd18ab543382367c550197e35942 Mon Sep 17 00:00:00 2001 From: Andreas Svensson Date: Wed, 2 Jul 2014 16:30:16 +0200 Subject: [PATCH] Fix IE8 potentially throwing during restoreSelection --- src/vendor/core/dom/focusNode.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vendor/core/dom/focusNode.js b/src/vendor/core/dom/focusNode.js index 9c7723e493..0c0ae60156 100644 --- a/src/vendor/core/dom/focusNode.js +++ b/src/vendor/core/dom/focusNode.js @@ -19,14 +19,15 @@ "use strict"; /** - * IE8 throws if an input/textarea is disabled and we try to focus it. - * Focus only when necessary. - * * @param {DOMElement} node input/textarea to focus */ function focusNode(node) { - if (!node.disabled) { + // IE8 can throw "Can't move focus to the control because it is invisible, + // not enabled, or of a type that does not accept the focus." for all kinds of + // reasons that are too expensive and fragile to test. + try { node.focus(); + } catch(e) { } }