private _resolved = false
private _numberProps: Record<string, true> | null = null
private _styles?: HTMLStyleElement[]
-
+ private _ob?: MutationObserver | null = null
constructor(
private _def: InnerComponentDef,
private _props: Record<string, any> = {},
disconnectedCallback() {
this._connected = false
+ if (this._ob) {
+ this._ob.disconnect()
+ this._ob = null
+ }
nextTick(() => {
if (!this._connected) {
render(null, this.shadowRoot!)
}
// watch future attr changes
- new MutationObserver(mutations => {
+ this._ob = new MutationObserver(mutations => {
for (const m of mutations) {
this._setAttr(m.attributeName!)
}
- }).observe(this, { attributes: true })
+ })
+
+ this._ob.observe(this, { attributes: true })
const resolve = (def: InnerComponentDef, isAsync = false) => {
const { props, styles } = def