Fix IE8 potentially throwing during restoreSelection

This commit is contained in:
Andreas Svensson
2014-07-14 21:07:56 +02:00
parent 17aef05d75
commit f8ccc2186f
+5 -4
View File
@@ -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) {
}
}