-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Order of stylesheet load events and script execution #4020
Copy link
Copy link
Closed
Description
First, I don't know whether there's an issue on file for this or not already.
Consider the following test-case, with a foo.css file that contains:
body { color: green }<!DOCTYPE html>
<link rel="stylesheet" href="foo.css" onload="console.log('onload')">
<body>
<script>
console.log("script");
console.log(getComputedStyle(document.body).color);
</script>Gecko will wait for the stylesheet to be loaded in order to execute the script, and thus will always log onload, then script, then rgb(0, 128, 0).
I haven't checked Edge, but Blink and WebKit both don't wait for the sheet load. What is the expected behavior here?
Just for reference, I found it because a website was relying on Gecko's behavior: rust-lang/mdBook#784
Reactions are currently unavailable