🐛 use shadow root element to query qiankun head directlly (#2148)

This commit is contained in:
Kuitos 2022-06-16 00:16:14 +08:00 committed by GitHub
parent 1faa094eb3
commit c73265db50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,8 +34,7 @@ declare global {
}
export const getAppWrapperHeadElement = (appWrapper: Element | ShadowRoot): Element => {
const rootElement = 'host' in appWrapper ? appWrapper.host : appWrapper;
return rootElement.getElementsByTagName(qiankunHeadTagName)[0];
return appWrapper.querySelector(qiankunHeadTagName)!;
};
export function isExecutableScriptType(script: HTMLScriptElement) {