Add shadow root support for isInDOM

By getting the "host" property when "parentNode" is undefined, the function can properly climb the DOM tree and allow monaco-editor to be used within a shadow root.
This commit is contained in:
Mathieu Plourde
2019-04-11 09:45:26 -04:00
committed by GitHub
parent d35d835730
commit 39bbc129a0

View File

@@ -32,7 +32,7 @@ export function isInDOM(node: Node | null): boolean {
if (node === document.body) {
return true;
}
node = node.parentNode;
node = node.parentNode || node.host;
}
return false;
}