This issue involves two points:
1. document.activeElement; acquired element is activated, no null is returned;
2. document.hasFocus (); determining whether there has been activated or acquire focus, returns a Boolean value;
There are the focus of the document must be activated (active), not vice versa.
In other words:
1. document.activeElement not empty, document.hasFocus () is not necessarily true;
2. document.hasFocus () is true, document.activeElement certainly not empty;