🐛 avoid accidentally deleted for dynamic stylesheet (#2147)

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

View File

@ -316,8 +316,13 @@ function getNewRemoveChild(
case STYLE_TAG_NAME:
case LINK_TAG_NAME: {
attachedElement = dynamicLinkAttachedInlineStyleMap.get(child as any) || child;
// try to remove the dynamic style sheet
dynamicStyleSheetElements.splice(dynamicStyleSheetElements.indexOf(attachedElement as any), 1);
const dynamicElementIndex = dynamicStyleSheetElements.indexOf(attachedElement as HTMLLinkElement);
if (dynamicElementIndex !== -1) {
dynamicStyleSheetElements.splice(dynamicElementIndex, 1);
}
break;
}