Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121777888
activeElement.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 13, 19:52
Size
669 B
Mime Type
text/x-java
Expires
Tue, Jul 15, 19:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27360581
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
activeElement.js
View Options
import
ownerDocument
from
'./ownerDocument'
;
/**
* Returns the actively focused element safely.
*
* @param doc the document to check
*/
export
default
function
activeElement
(
doc
)
{
if
(
doc
===
void
0
)
{
doc
=
ownerDocument
();
}
// Support: IE 9 only
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try
{
var
active
=
doc
.
activeElement
;
// IE11 returns a seemingly empty object in some cases when accessing
// document.activeElement from an <iframe>
if
(
!
active
||
!
active
.
nodeName
)
return
null
;
return
active
;
}
catch
(
e
)
{
/* ie throws if no active element */
return
doc
.
body
;
}
}
Event Timeline
Log In to Comment