You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
729 B
26 lines
729 B
"use strict"; |
|
|
|
Object.defineProperty(exports, "__esModule", { |
|
value: true |
|
}); |
|
exports.getActiveElement = getActiveElement; |
|
|
|
var _isDisabled = require("../misc/isDisabled"); |
|
|
|
function getActiveElement(document) { |
|
const activeElement = document.activeElement; |
|
|
|
if (activeElement != null && activeElement.shadowRoot) { |
|
return getActiveElement(activeElement.shadowRoot); |
|
} else { |
|
// Browser does not yield disabled elements as document.activeElement - jsdom does |
|
if ((0, _isDisabled.isDisabled)(activeElement)) { |
|
return document.ownerDocument ? // TODO: verify behavior in ShadowRoot |
|
|
|
/* istanbul ignore next */ |
|
document.ownerDocument.body : document.body; |
|
} |
|
|
|
return activeElement; |
|
} |
|
} |