mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Merge remote-tracking branch 'origin/master' into pr/lmvco/88536
This commit is contained in:
@@ -820,6 +820,23 @@ export function hasParentWithClass(node: HTMLElement, clazz: string, stopAtClazz
|
||||
return !!findParentWithClass(node, clazz, stopAtClazzOrNode);
|
||||
}
|
||||
|
||||
export function isShadowRoot(node: Node): node is ShadowRoot {
|
||||
return (
|
||||
node && !!(<ShadowRoot>node).host && !!(<ShadowRoot>node).mode
|
||||
);
|
||||
}
|
||||
|
||||
export function isInShadowDOM(domNode: Node): boolean {
|
||||
while (domNode.parentNode) {
|
||||
if (domNode === document.body) {
|
||||
// reached the body
|
||||
return false;
|
||||
}
|
||||
domNode = domNode.parentNode;
|
||||
}
|
||||
return isShadowRoot(domNode);
|
||||
}
|
||||
|
||||
export function createStyleSheet(container: HTMLElement | null = null): HTMLStyleElement {
|
||||
if (!container) {
|
||||
if ((window as any).monacoShadowRoot) {
|
||||
|
||||
Reference in New Issue
Block a user