Re: [whatwg/dom] Introduce DOM post-insertion steps (PR #1261)

@domfarolino commented on this pull request.



>  <!-- See https://github.com/whatwg/dom/issues/34#issuecomment-125571750 for why we might need to
      adjust this further based on the requirements of the script element. There might be other ways
      to define that though as Olli suggests, so leaving that out for now. -->
 
+<p><a lt="Other applicable specifications">Specifications</a> may also define <dfn export
+id=concept-node-post-insert-ext>post-insertion steps</dfn> for all or some <a for=/>nodes</a>. The
+algorithm is passed <var ignore>insertedNode</var>, as indicated in the <a
+for=/>insert</a> algorithm below.
+
+<p class=note>The purpose of the <a>post-insertion steps</a> is to provide an opportunity for <a
+for=/>nodes</a> to perform any insertion-related operations that modify the <a>node tree</a> that
+<var ignore>insertedNode</var> <a>participates</a> in, create <a for=/>browsing contexts</a>, or
+otherwise execute JavaScript. These steps allow a batch of <a>nodes</a> to be <a for=/>inserted</a>
+<i>atomically</i> with respect to script, with all major side effects occurring <i>after</i> the
+batch insertions into the <a>node tree</a> is complete, but before <a lt="notify mutation
+observers"><code>MutationObserver</code>s are notified</a>. This ensures that all pending <a>node

I added this in https://github.com/whatwg/dom/pull/1261/commits/164eae9b4bc2ea64a8a7426d6ac82e55c9904639, in response to https://github.com/whatwg/dom/pull/1261#discussion_r1520204437 which mentioned MutationObservers. Idk, for this non-normative text it seemed reasonable to just drive home the point that this all happens technically after insertion, but still very much synchronously, and therefore earlier than the next-soonest reaction timing thing, which is MutationObserver firing. If you feel strongly, I'm happy to remove if Anne agrees.

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

Message ID: <whatwg/dom/pull/1261/review/1960850771@github.com>

Received on Tuesday, 26 March 2024 15:42:10 UTC