You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Timing of CE reactions with adoption agency #13072
When the adoption agency algorithm
(AAA) moves already-constructed nodes around, the spec never pushes an element queue, so any custom element reactions caused by those moves end up in the backup element queue and only run at the next microtask checkpoint. Chromium (per the code pointers in #12758 (comment)
) appears to instead wrap each individual construction-site move in a CEReactionsScope, so the reactions run synchronously after each move. This is not interoperable and not covered by WPT. Which behavior do we want?
Status quo: reactions for AAA moves go to the backup element queue. Simple, but the callbacks run after arbitrary later content has been parsed (possibly after a subsequent inline <script> has run and observed the DOM), and disconnectedCallback can run while the element is already connected again.
One element queue per move (what Chromium seems to do): wrap each remove/insert/append in the AAA in its own element queue. Every callback then sees an accurate isConnected, and the callback ordering is per move. This is also closest to what insert an element at the adjusted insertion location already does.
One element queue around the whole AAA run: same set of callbacks as (2), but batched and run once at the end of the AAA. Fewer re-entrancy points, but disconnectedCallback still runs while the element is connected.
Activity