[whatwg] should we add beforeload/afterload events to the web platform?

Boris Zbarsky bzbarsky at MIT.EDU
Mon Jan 9 22:02:00 PST 2012


On 1/10/12 12:48 AM, Tantek Çelik wrote:
> Mozilla is strongly considering implementing 'beforeload' and 'afterload'.[4]

It's more like one person in a Mozilla bug has suggested that it be 
implemented, while others, myself included, are a bit skeptical.

The devil, of course, is in the details; if this event is specified very 
carefully it might simply slow down pageload a bit, more so as browsers 
introduce more parallelism because background threads or processes that 
might be able to perform the load will have to block on the main page JS 
thread to handle the event first.  If done carelessly (e.g. the event 
target is the node the load is associated with), it'll be a pretty large 
slowdown.  For example, that approach precludes the sort of speculative 
parsers UAs use nowadays to deal with having to block parsing on 
<script> tags.

> Should 'beforeload'/'afterload' be explicitly specified and added to
> the web platform?

Outside of extensions, what are the use cases?  Can they usefully labor 
under restrictions like knowing the URI to be loaded but not the context 
it's being loaded in?  AdBlock apparently can in at least some cases, yes?

I'd like to understand the client-side transformation use-case better, 
in particular.  What is it really trying to do?

-Boris



More information about the whatwg mailing list