diff --git a/source b/source index 4f422ad497a..0247142a2ce 100644 --- a/source +++ b/source @@ -66945,6 +66945,34 @@ customElements.define("x-foo", class extends HTMLElement { reaction code can perform its own mutations, it is not possible to give a global ordering guarantee across multiple elements.)
+An element's connectedCallback
can be queued before the element is
+ disconnected, but as the callback queue is still processed, it results in a connectedCallback
for an element that is no longer connected:
class CParent extends HTMLElement {
+ connectedCallback() {
+ this.firstChild.remove();
+ }
+}
+customElements.define("c-parent", CParent);
+
+class CChild extends HTMLElement {
+ connectedCallback() {
+ console.log("CChild connectedCallback: isConnected =", this.isConnected);
+ }
+}
+customElements.define("c-child", CChild);
+
+const container = document.createElement("div");
+container.innerHTML = "<c-parent><c-child></c-child></c-parent>";
+customElements.upgrade(container);
+document.body.appendChild(container);
+
+// Logs:
+// CChild connectedCallback: isConnected = false
+