1/** 2 * Copyright 2014, Facebook, Inc. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. An additional grant 7 * of patent rights can be found in the PATENTS file in the same directory. 8 * 9 * @providesModule focusNode 10 */ 11 12"use strict"; 13 14/** 15 * @param {DOMElement} node input/textarea to focus 16 */ 17function focusNode(node) { 18 // IE8 can throw "Can't move focus to the control because it is invisible, 19 // not enabled, or of a type that does not accept the focus." for all kinds of 20 // reasons that are too expensive and fragile to test. 21 try { 22 node.focus(); 23 } catch(e) { 24 } 25} 26 27module.exports = focusNode; 28 29