This commit is contained in:
SteVen Batten
2020-07-24 14:06:09 -07:00
parent 86c04f72be
commit f74e473238
4 changed files with 17 additions and 7 deletions

View File

@@ -749,6 +749,16 @@ export function getShadowRoot(domNode: Node): ShadowRoot | null {
return isShadowRoot(domNode) ? domNode : null;
}
export function getActiveElement(): Element | null {
let result = document.activeElement;
while (result?.shadowRoot) {
result = result.shadowRoot.activeElement;
}
return result;
}
export function createStyleSheet(container: HTMLElement = document.getElementsByTagName('head')[0]): HTMLStyleElement {
let style = document.createElement('style');
style.type = 'text/css';