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

Tantek Çelik tantek at cs.stanford.edu
Mon Jan 9 21:48:03 PST 2012


WebKit supports a 'beforeload' event [1] which is supported in
shipping Safari and Chrome[2]
and apparently has (enabled) the real-world use-cases of:

1. Performance. Reducing bandwidth use / HTTP requests, e.g. AdBlock
extension[2]
2. Clientside transformations, e.g. Mobify[3]


As might be expected, there is at least one use-case for a
complementary 'afterload' event:

1. Downloadable fonts - people who want to use custom fonts for
drawing in the canvas element need to know when a font has loaded.
'afterload' seems like a good way to know that, since it happens as a
side effect of actually using it and fonts don't have an explicit load
API like images do.[4]


Safari and Chrome have already shipped 'beforeload', and Mozilla is
strongly considering implementing 'beforeload' and 'afterload'.[4]

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

Rather than attempt to provide a specific detailed design at this
point, I'd prefer to ask for the list's consideration/discussion, and
leave detailed specification of the two events to the editor.

Thanks,

Tantek

[1] http://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html
[2] http://google-chrome-browser.com/tags/beforeload
[3] http://mobify.com/static/talks/client-side-transformations.html#27
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=715695#c9

-- 
http://tantek.com/ - I made an HTML5 tutorial! http://tantek.com/html5


More information about the whatwg mailing list