-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order of stylesheet load events and script execution #4020
Comments
cc @bzbarsky |
cc @domfarolino |
What exactly is the behavior you're experiencing with Blink/WebKit? I've spun up script-after-style, which is the code in your comment, however the
This output appears only after 3 seconds (after the |
Hmm, I guess the load event order confused me a lot, but you're right that it was spec'd. What I saw I guess is a (potentially related) Chrome bug, that you can see in: https://script-after-style-.glitch.me (Sorry, shamelessly copy-pasted :)). I'd also expect the disabled CSSOM setter to take effect. |
The effect seems spec'd, however the order might violate something that I'm currently digging around looking for. RE the site you've pasted above, I'm seeing the word "Should not be red", in black text in both latest Chrome (and stable actually), and Firefox. Is there a difference/effect that I'm missing? |
I see it red in Chrome |
Interesting. Regardless, the ordering of outputs seems interesting...perhaps we should rename this issue? I've also written http://script-after-style.glitch.me/test.html, which you can view-source of to see a test that illustrates the ordering being quite observable. Have to see if this is a violation though (haven't had much time today). |
Yeah, renaming sounds great, though not sure to what... "Order of stylesheet load events and script execution" maybe? Feel free to rename it if needed. |
Happy to dupe this into #3610. |
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:Gecko will wait for the stylesheet to be loaded in order to execute the script, and thus will always log
onload
, thenscript
, thenrgb(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
The text was updated successfully, but these errors were encountered: