Below is taken from the spec (http://dev.w3.org/html5/spec/Overview.html#the-style-element): "Once the attempts to obtain the style sheet's critical subresources, if any, are complete, or, if the style sheet has no critical subresources, once the style sheet has been parsed and processed, the user agent must, if the loads were successful or there were none, queue a task to fire a simple event named load at the style element, or, if one of the style sheet's critical subresources failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being prematurely closed, unsupported Content-Type), queue a task to fire a simple event named error at the style element. Non-network errors in processing the style sheet or its subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of this paragraph."
I have set aside time this week to peek at this. Hopefully I"ll have something soon.
Loosely related are: https://bugs.webkit.org/show_bug.cgi?id=38995 http://www.phpied.com/when-is-a-stylesheet-really-loaded/
This reminds me of the recent work on link elements firing load events.
Safari Technology Preview 151 seems to pass this test case: https://wpt.fyi/results/html/semantics/document-metadata/the-style-element/style_load_event.html?label=master&label=experimental&aligned&view=subtest&q=style%20load%20event Is something else needed here or I am looking at wrong test case? Thanks!
Created attachment 461755 [details] test case This seems to be working now.