Browsers synchronously fire pagehide
& unload
, while the standard doesn't
#10194
Labels
removal/deprecation
Removing or deprecating a feature
What is the issue with the HTML Standard?
This isn't as much an issue with the HTML Standard, as it is a compat discussion about whether we should move it forward in an undesirable way to match what all implementations do, vs get implementations to commit to match the standard.
Per HTML, the iframe removing steps should not synchronously invoke any script in the event loop that triggered the removal. This is not only clear in the algorithms called in the removal process, but made extra clear by the note just below this dfn: https://html.spec.whatwg.org/C#the-iframe-element:html-element-removing-steps
Unfortunately, all browsers seem to synchronously fire the
pagehide
event during same-origin iframe removal, and depending on the status of their unload interventions, that event too: https://wpt.fyi/results/dom/nodes/insertion-removing-steps/insertion-removing-steps-iframe.window.html?label=experimental&label=master&aligned.I mentioned this in whatwg/dom#808 when exploring all of the opportunities that spec and implementations have to synchronously fire script in the node insertion & removal process.
Chrome is interested in experimenting (cc: @noamr @mfreed7) with the suppression of these events in at least the frame removal case, but since this carries possibly-significant compatibility risk, and since all browsers are currently aligned, we wanted to start some discussion with other vendors and editors before proceeding. I'll loop in @smaug---- and @rniwa (and @annevk since he's been involved in whatwg/dom#808), but please feel free to loop others in with more context or opinions on this. It'd be unfortunate if we had to keep this instance of synchronous script execution around forever, but I'd love to get more thoughts on how difficult it would be to remove it.
The text was updated successfully, but these errors were encountered: