File tree 1 file changed +29
-0
lines changed 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -66945,6 +66945,34 @@ customElements.define("x-foo", class extends HTMLElement {
66945
66945
reaction</span> code can perform its own mutations, it is not possible to give a global ordering
66946
66946
guarantee across multiple elements.)</p>
66947
66947
66948
+ <div class="example">
66949
+ <p>An element's <code data-x="">connectedCallback</code> can be queued before the element is
66950
+ disconnected, but as the callback queue is still processed, it results in a <code
66951
+ data-x="">connectedCallback</code> for an element that is no longer connected:</p>
66952
+
66953
+ <pre><code class="js" data-x="">class CParent extends HTMLElement {
66954
+ connectedCallback() {
66955
+ this.firstChild.remove();
66956
+ }
66957
+ }
66958
+ customElements.define("c-parent", CParent);
66959
+
66960
+ class CChild extends HTMLElement {
66961
+ connectedCallback() {
66962
+ console.log("CChild connectedCallback: isConnected =", this.isConnected);
66963
+ }
66964
+ }
66965
+ customElements.define("c-child", CChild);
66966
+
66967
+ const container = document.createElement("div");
66968
+ container.innerHTML = "<c-parent><c-child></c-child></c-parent>";
66969
+ customElements.upgrade(container);
66970
+ document.body.appendChild(container);
66971
+
66972
+ // Logs:
66973
+ // CChild connectedCallback: isConnected = false</code></pre>
66974
+ </div>
66975
+
66948
66976
<div w-nodev>
66949
66977
66950
66978
<hr>
@@ -122593,6 +122621,7 @@ INSERT INTERFACES HERE
122593
122621
Tom Pike,
122594
122622
Tom Schuster,
122595
122623
Tomasz Jakut, <!-- Comandeer on GitHub -->
122624
+ Tomek Wytrębowicz,
122596
122625
Tommy Thorsen,
122597
122626
Tony Ross,
122598
122627
Tooru Fujisawa,
You can’t perform that action at this time.
0 commit comments