Skip to content

Commit 75cabcf

Browse files
committed
fix(element): call attachShadow only if shadowRoot does not exist
fix #1217
1 parent 6b8e5ff commit 75cabcf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/element/src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,11 @@ export default class CropperElement extends HTMLElement {
165165
});
166166
});
167167

168-
const shadow = this.attachShadow({
168+
const shadow = this.shadowRoot || this.attachShadow({
169169
mode: this.shadowRootMode || DEFAULT_SHADOW_ROOT_MODE,
170170
});
171171

172-
if (!this.shadowRoot) {
173-
shadowRoots.set(this, shadow);
174-
}
175-
172+
shadowRoots.set(this, shadow);
176173
styleSheets.set(this, this.$addStyles(this.$sharedStyle));
177174

178175
if (this.$style) {

0 commit comments

Comments
 (0)