[whatwg/dom] Enqueue lifecycle callbacks before insertion/removing/moving steps (PR #1520)

Enqueue connectedCallback (or try to upgrade), disconnectedCallback, and connectedMoveCallback before running the insertion, removing, and moving steps, so that any reactions those steps enqueue for the same element, such as formAssociatedCallback or an attributeChangedCallback from details exclusivity, run after the lifecycle callback. This matches what browsers do for insertion, and what Chromium and WebKit do for removal.

<!--
Thank you for contributing to the DOM Standard! Please describe the change you are making and complete the checklist below if your change is not editorial.

When you submit this PR, and each time you edit this comment (including checking a checkbox through the UI!), PR Preview will run and update it. As such make any edits in one go and only after PR Preview has run.

If you think your PR is ready to land, please double-check that the build is passing and the checklist is complete before pinging.
-->

- [ ] At least two implementers are interested (and none opposed):
   * Chromium (passes all associated tests)
   * 
- [x] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * https://github.com/web-platform-tests/wpt/pull/64663
   * Test coverage for connectedMoveCallback will be added as part of follow-ups, the spec is currently quite broken here, (browsers also behave oddly).
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chromium: N/A
   * Gecko: TODO
   * WebKit: https://bugs.webkit.org/show_bug.cgi?id=325679
   * Deno (only for aborting and events): …
   * Node.js (only for aborting and events): …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [ ] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use. <!-- If you created this PR from a single commit, Github copied its message. Otherwise, you need to add a commit message yourself. -->

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://whatpr.org/dom/1520.html" title="Last updated on Nov 3, 2026, 3:27 PM UTC (f1a8ccb)">Preview</a> | <a href="https://whatpr.org/dom/1520/3c53f93...f1a8ccb.html" title="Last updated on Nov 3, 2026, 3:27 PM UTC (f1a8ccb)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/dom/pull/1520

-- Commit Summary --

  * Enqueue lifecycle callbacks before insertion/removing/moving steps

-- File Changes --

    M dom.bs (42)

-- Patch Links --

https://github.com/whatwg/dom/pull/1520.patch
https://github.com/whatwg/dom/pull/1520.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1520
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1520@github.com>

Received on Tuesday, 3 November 2026 15:27:39 UTC