function getActiveElement() /*?DOMElement*/{
	  if (typeof document === 'undefined') {
	    return null;
	  }

	  try {
	    return document.activeElement || document.body;
	  } catch (e) {
	    return document.body;
	  }
	}
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.