- From: Anthony Ramine <notifications@github.com>
- Date: Tue, 12 Feb 2019 02:38:41 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 12 February 2019 10:39:04 UTC
> Except in Edge (and maybe Safari given how it executes scripts while inserting them rather than after they are all inserted), `style.sheet` initialization is queued similar to scripts. That's wrong, turns out Chrome already created the stylesheet by the time the script is executed, and the only reason Safari logs `null` is because the style element isn't even yet in the document tree because it inserts the fragment's children one by one. If you change the sample to use a `div` instead, Safari logs an existing style sheet. ```html <script> var s1 = document.createElement("style"); s1.textContent = "body { background:lime }"; var s2 = document.createElement("script"); s2.textContent = "w(s1.sheet)"; var df = document.createElement("div"); df.appendChild(s2); df.appendChild(s1); document.head.appendChild(df); </script> ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/576#issuecomment-462708226
Received on Tuesday, 12 February 2019 10:39:04 UTC