- From: Anne van Kesteren <notifications@github.com>
- Date: Thu, 04 Apr 2024 02:50:32 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1261/review/1979354232@github.com>
@annevk 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. This ensures that all pending <a>node +tree</a> insertions completely finish before more insertions can occur. + Why a double newline here? > @@ -2724,25 +2783,26 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run <p>For each <a>shadow-including inclusive descendant</a> <var>inclusiveDescendant</var> of <var>node</var>, in <a>shadow-including tree order</a>: - <ol> - <li><p>Run the <a>insertion steps</a> with <var>inclusiveDescendant</var>. + <ol> This is also wrong. > + const h1 = document.querySelector('h1'); + + const fragment = new DocumentFragment(); + const script = fragment.appendChild(document.createElement('script')); + const style = fragment.appendChild(document.createElement('style')); + + script.innerText= 'console.log(getComputedStyle(h1).color)'; // Prints 'rgb(255, 0, 0)' + style.innerText = 'h1 {color: rgb(255, 0, 0);}'; + + document.body.append(fragment); + </code></pre> + + <p>The script in the above example prints <code class=lang-javascript>'rgb(255, 0, 0)'</code> + because the following happen in order: + + <ol> I'm not sure what happened, but this is still wrong. The `<ol>` should have the same amount of indentation as the `<p>` before it. They are siblings after all. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/1261#pullrequestreview-1979354232 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/pull/1261/review/1979354232@github.com>
Received on Thursday, 4 April 2024 09:50:36 UTC