MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / getActiveElement

Function getActiveElement

code/new-context-api/public/app.js:351–361  ·  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

349 * @return {?DOMElement}
350 */
351function getActiveElement(doc) /*?DOMElement*/{
352 doc = doc || (typeof document !== 'undefined' ? document : undefined);
353 if (typeof doc === 'undefined') {
354 return null;
355 }
356 try {
357 return doc.activeElement || doc.body;
358 } catch (e) {
359 return doc.body;
360 }
361}
362
363module.exports = getActiveElement;
364},{}],12:[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