File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ export class VueElement extends BaseClass {
178
178
private _resolved = false
179
179
private _numberProps : Record < string , true > | null = null
180
180
private _styles ?: HTMLStyleElement [ ]
181
-
181
+ private _ob ?: MutationObserver | null = null
182
182
constructor (
183
183
private _def : InnerComponentDef ,
184
184
private _props : Record < string , any > = { } ,
@@ -215,6 +215,10 @@ export class VueElement extends BaseClass {
215
215
216
216
disconnectedCallback ( ) {
217
217
this . _connected = false
218
+ if ( this . _ob ) {
219
+ this . _ob . disconnect ( )
220
+ this . _ob = null
221
+ }
218
222
nextTick ( ( ) => {
219
223
if ( ! this . _connected ) {
220
224
render ( null , this . shadowRoot ! )
@@ -235,11 +239,13 @@ export class VueElement extends BaseClass {
235
239
}
236
240
237
241
// watch future attr changes
238
- new MutationObserver ( mutations => {
242
+ this . _ob = new MutationObserver ( mutations => {
239
243
for ( const m of mutations ) {
240
244
this . _setAttr ( m . attributeName ! )
241
245
}
242
- } ) . observe ( this , { attributes : true } )
246
+ } )
247
+
248
+ this . _ob . observe ( this , { attributes : true } )
243
249
244
250
const resolve = ( def : InnerComponentDef , isAsync = false ) => {
245
251
const { props, styles } = def
You can’t perform that action at this time.
0 commit comments