-
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
Consider changing task source for link "error"/"load" events #3610
Comments
It looks like I'm on track to fix it as part of that. |
I am no longer on track to fix it as part of that, as #3544 descended into "oh gawd everything is broken we need to start over and write a ton of tests". So, a more targeted fix for just the task source issue would make more sense. |
The issue regarding the ordering of
If it's the former, the spec is fine and Chrome has a bug. If it's the latter, I think it would be nice to try and change the spec to make it the former, so we can guarantee, at least in this circumstance, well-ordered event dispatching. EditAnne has answered this over IRC. The plan moving forward wrt the weird ordering is probably to:
|
@domfarolino's plan sounds good to me, fwiw. |
* Introduce new link loading infrastructure, specifically algorithms to fetch and process linked resources that are overridable by the individual link types. This replaces the previous "obtain the resource" algorithms with something more structured and rigorous. * Specify the order in which style sheets are removed, created/added, their corresponding load/error events are fired, and scripting is unblocked from a loading style sheet. * Replace "style sheet done" flag with Document's "script-blocking style sheet counter", which works in tandem with the "contributes a script-blocking style sheet" conditions, which replaces the definition of "a style sheet that is blocking scripts". * Change <link> load/fire events to be fired from tasks queued on the networking task source, instead of the DOM manipulation task source. * Handle much of what whatwg#3544 set out to do, minus defining and explicitly fetching a style sheet's critical subresources. Fixes whatwg#3610. Tests: web-platform-tests/wpt#14899
* Introduce new link loading infrastructure, specifically algorithms to fetch and process linked resources that are overridable by the individual link types. This replaces the previous "obtain the resource" algorithms with something more structured and rigorous. * Specify the order in which style sheets are removed, created/added, their corresponding load/error events are fired, and scripting is unblocked from a loading style sheet. * Replace "style sheet done" flag with Document's "script-blocking style sheet counter", which works in tandem with the "contributes a script-blocking style sheet" conditions, which replaces the definition of "a style sheet that is blocking scripts". * Change <link> load/fire events to be fired from tasks queued on the networking task source, instead of the DOM manipulation task source. * Handle much of what whatwg#3544 set out to do, minus defining and explicitly fetching a style sheet's critical subresources. Fixes whatwg#3610. Tests: web-platform-tests/wpt#14899
Right now the spec the spec mentions at the bottom of 4.2.4.3 Obtaining a resource from a link element that the task source for the "error"/"load" events is the DOM manipulation task source. Given the aforementioned events are primarily network-based, it might make sense to queue these from the networking task source instead.
Aside:
I created this gist to see if I could observe the "load" event of a link element that is blocking the pending parsing-blocking script of a Document, before the script's execution, and even further before the
DOMContentLoaded
event is observed. Given the gist, Chrome gives the following in the console:while Firefox yields:
The latter makes more sense to me, since for the inline script to run, the link event has to be loaded, of course. The spec is written this way, and Chrome is currently non-compliant (there are actually two issues with Chrome, DOMContentLoaded is fired synchronously and the networking task source is actually used for the link element).
However, Anne makes a good point in that networking-driven events should come from the networking task source, which can of course be prioritized in an implementation-dependent manner relevant to the DOM manipulation task source. This example is a specific instance where it would be convenient otherwise, but his point overall makes sense.
The text was updated successfully, but these errors were encountered: