mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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.
This commit is contained in:
committed by
Paul O’Shannessy
parent
46713c3d7d
commit
3f2ba221ef
@@ -20,17 +20,9 @@
|
||||
|
||||
var ReactDOMSelection = require('ReactDOMSelection');
|
||||
|
||||
var getActiveElement = require('getActiveElement');
|
||||
var nodeContains = require('nodeContains');
|
||||
|
||||
// It is not safe to read the document.activeElement property in IE if there's
|
||||
// nothing focused.
|
||||
function getActiveElement() {
|
||||
try {
|
||||
return document.activeElement;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
function isInDocument(node) {
|
||||
return nodeContains(document.documentElement, node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user