el.activeElement
in the following method will be null
if el
is a document fragment rather than an element, which throws a runtime error:
|
function getActiveElement(el = document) { |
|
return el.activeElement.shadowRoot |
|
? getActiveElement(el.activeElement.shadowRoot) |
|
: el.activeElement; |
|
} |