diff --git a/src/sheet.ts b/src/sheet.ts index fdeb0e868..b5ca31419 100644 --- a/src/sheet.ts +++ b/src/sheet.ts @@ -142,20 +142,14 @@ export class StyleSheet extends MutationObserver { } } } - } else { - if (target.isConnected) { - classNames.forEach((className) => { - if (!oldClassNames.includes(className)) { - addClassName(className); - } - }) - for (const oldClassName of oldClassNames) { - if (!classNames.contains(oldClassName)) { - removeClassName(oldClassName); - } + } else if (target.isConnected) { + classNames.forEach((className) => { + if (!oldClassNames.includes(className)) { + addClassName(className); } - } else { - for (const oldClassName of oldClassNames) { + }) + for (const oldClassName of oldClassNames) { + if (!classNames.contains(oldClassName)) { removeClassName(oldClassName); } }