File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 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 {
178178 private _resolved = false
179179 private _numberProps : Record < string , true > | null = null
180180 private _styles ?: HTMLStyleElement [ ]
181-
181+ private _ob ?: MutationObserver | null = null
182182 constructor (
183183 private _def : InnerComponentDef ,
184184 private _props : Record < string , any > = { } ,
@@ -215,6 +215,10 @@ export class VueElement extends BaseClass {
215215
216216 disconnectedCallback ( ) {
217217 this . _connected = false
218+ if ( this . _ob ) {
219+ this . _ob . disconnect ( )
220+ this . _ob = null
221+ }
218222 nextTick ( ( ) => {
219223 if ( ! this . _connected ) {
220224 render ( null , this . shadowRoot ! )
@@ -235,11 +239,13 @@ export class VueElement extends BaseClass {
235239 }
236240
237241 // watch future attr changes
238- new MutationObserver ( mutations => {
242+ this . _ob = new MutationObserver ( mutations => {
239243 for ( const m of mutations ) {
240244 this . _setAttr ( m . attributeName ! )
241245 }
242- } ) . observe ( this , { attributes : true } )
246+ } )
247+
248+ this . _ob . observe ( this , { attributes : true } )
243249
244250 const resolve = ( def : InnerComponentDef , isAsync = false ) => {
245251 const { props, styles } = def
You can’t perform that action at this time.
0 commit comments