- From: Noam Rosenthal <notifications@github.com>
- Date: Fri, 14 Feb 2025 23:51:47 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 15 February 2025 07:51:51 UTC
noamr left a comment (whatwg/dom#1270) > > * Perhaps add a `movedCallback`, that has a default to call `disconnectedCallback` and `connectedCallback`? > > Defaulting to calling `disconnectedCallback` and `connectedCallback` would provide no benefit though. We can just use `disconnectedCallback` and `connectedCallback` already! > > This would be a lot more useful: > > ```js > movedCallback(previousParent) { > const newParent = this.parent > > // ... > } > ``` > > otherwise with `disconnectedCallback` and `connectedCallback` custom elements will, by default, be destroying and re-creating things unnecessarily, which totally defeats the purpose of the atomic reparenting in the first place. > > Instead `moveCallback` would be a **differentiator** that the element was *not* disconnected, but merely moved. And alias would not help here. You get ‘connectedMoveCallback‘, the existing callbacks are called only when it's not provided in case your existing lifecycle checks for things about the parent, for example -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1270#issuecomment-2660799362 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1270/2660799362@github.com>
Received on Saturday, 15 February 2025 07:51:51 UTC