Use getActiveElement module
We had something that did the same sort of protection. The module differs slightly (returns document.body instead of undefined) but looking at the callers, that should be ok.
Paul O'Shannessy committed
Oct 15, 2013 at 17:57 UTC
3f2ba221ef3cb514d15680b7736c37b016aa2064
1 file changed
+1
-9
src/core/ReactInputSelection.js
+1
-9
@@ -20,17 +20,9 @@
20
21
var ReactDOMSelection = require('ReactDOMSelection');
22
23
+var getActiveElement = require('getActiveElement');
24
var nodeContains = require('nodeContains');
25
25
-// It is not safe to read the document.activeElement property in IE if there's
26
-// nothing focused.
27
-function getActiveElement() {
28
- try {
29
- return document.activeElement;
30
- } catch (e) {
31
- }
32
-}
33
-
26
function isInDocument(node) {
27
return nodeContains(document.documentElement, node);
28
}