Fix IE8 potentially throwing during restoreSelection
Andreas Svensson committed
Jul 2, 2014 at 16:30 UTC
f8ccc2186fd3dd18ab543382367c550197e35942
1 file changed
+5
-4
src/vendor/core/dom/focusNode.js
+5
-4
@@ -19,14 +19,15 @@
19
"use strict";
20
21
/**
22
- * IE8 throws if an input/textarea is disabled and we try to focus it.
23
- * Focus only when necessary.
24
- *
22
* @param {DOMElement} node input/textarea to focus
23
*/
24
function focusNode(node) {
28
- if (!node.disabled) {
25
+ // IE8 can throw "Can't move focus to the control because it is invisible,
26
+ // not enabled, or of a type that does not accept the focus." for all kinds of
27
+ // reasons that are too expensive and fragile to test.
28
+ try {
29
node.focus();
30
+ } catch(e) {
31
}
32
}
33