MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getActiveElement

Function getActiveElement

code/higher-order-components/public/app.js:344–354  ·  view source on GitHub ↗

* Same as document.activeElement but wraps in a try-catch block. In IE it is * not safe to call document.activeElement if there is nothing focused. * * The activeElement will be null only if the document or document body is not * yet defined. * * @param {?DOMDocument} doc Defaults to current d

(doc)

Source from the content-addressed store, hash-verified

342 * @return {?DOMElement}
343 */
344function getActiveElement(doc) /*?DOMElement*/{
345 doc = doc || (typeof document !== 'undefined' ? document : undefined);
346 if (typeof doc === 'undefined') {
347 return null;
348 }
349 try {
350 return doc.activeElement || doc.body;
351 } catch (e) {
352 return doc.body;
353 }
354}
355
356module.exports = getActiveElement;
357},{}],10:[function(require,module,exports){

Callers 3

getSelectionInformationFunction · 0.70
restoreSelectionFunction · 0.70
constructSelectEventFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected