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

@domfarolino commented on this pull request.



> + 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>

Should be good now. Apologies for the churn.

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

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

Received on Thursday, 4 April 2024 14:22:41 UTC