diff --git a/src/html.js b/src/html.js
index 1842aa3..456e557 100644
--- a/src/html.js
+++ b/src/html.js
@@ -248,7 +248,6 @@ class Template {
class TemplateInstance {
constructor(template, parent) {
this._parts = []
- this._$disconnectableChildren = void 0
this._$template = template
this._$parent = parent
}
@@ -349,15 +348,14 @@ class ChildPart {
constructor(startNode, endNode, parent, options) {
this.type = CHILD_PART
this._$committedValue = NOTHING
- this._$disconnectableChildren = void 0
this._$startNode = startNode
this._$endNode = endNode
this._$parent = parent
this.options = options
- this.__isConnected = options.isConnected || true
+ this.__isConnected = options.isConnected ?? true
}
get _$isConnected() {
- return this._$parent?._$isConnected || this.__isConnected
+ return this._$parent?._$isConnected ?? this.__isConnected
}
get parentNode() {
let parentNode = this._$startNode.parentNode
@@ -475,8 +473,6 @@ class ChildPart {
}
#clear(start = this._$startNode.nextSibling, from) {
- this._$notifyConnectionChanged?.call(this, false, true, from)
-
while (start && start !== this._$endNode) {
let node = start.nextSibling
start.remove()
@@ -486,7 +482,6 @@ class ChildPart {
setConnected(isConnected) {
if (this._$parent === void 0) {
this.__isConnected = isConnected
- this._$notifyConnectionChanged?.call(this, isConnected)
}
}
}
@@ -495,7 +490,6 @@ class AttributePart {
constructor(element, name, strings, decorates, parent, options = {}) {
this.type = ATTRIBUTE_PART
this._$committedValue = NOTHING
- this._$disconnectableChildren = void 0
this.element = element
this.name = name
this.decorates = decorates
@@ -688,7 +682,6 @@ class ElementPart {
constructor(element, parent, options) {
this.element = element
this.type = ELEMENT_PART
- this._$disconnectableChildren = void 0
this._$parent = parent
this.options = options
}
diff --git a/src/index.js b/src/index.js
index 895dbe3..84b28a1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -253,8 +253,6 @@ export class Component extends HTMLElement {
}
this.#init()
adoptStyles(this.root, this.constructor.styles)
-
- this[__children__]?.setConnected(true)
}
disconnectedCallback() {
@@ -382,6 +380,7 @@ export class Component extends HTMLElement {
// 初始化时不触发updated回调
if (this[__mounted__] === false) {
this[__mounted__] = true
+ this[__children__].setConnected(true)
if (this.$animate?.immediate) {
this.$animate()
}