[whatwg] API to delay the document load event

Glenn Maynard glenn at zewt.org
Sun Apr 28 16:08:03 PDT 2013

On Sun, Apr 28, 2013 at 5:39 PM, David Bruant <bruant.d at gmail.com> wrote:

> Le 29/04/2013 00:14, Robert O'Callahan a écrit :
>  We don't want to require people to do everything in Caja just to support
>> composition of independent scripts.
> There are certainly more lightweight solutions than Caja to achieve the
> same thing.

Which is exactly the problem: you're saying there are multiple solutions,
which means incompatibility.

 If your scripts are that independent, how do you know if one forgets to
> call document.stopDelayingLoadEvent()? This is a footgun.

The approach I've suggested makes tracking misuse easy; just stash a stack
trace when creating the object, and provide a console API to print the
stack trace for delays that haven't been finished, or if an object gets
collected without being finished.

This is also additional surface for web browsers to mess up which they
> already have enough to deal with.

The proposal here is trivial as web APIs go, so I don't buy this.

> Give one way to signal that the application is ready. Devs will figure out
> the rest. One way to signal that the application is ready will serve at
> least 80% (maybe 90%) of the needs anyway.

I think every proposal so far gives exactly one way to signal, so I don't
know what this means.

In this context, trying to support composition of independent scripts is
> most likely over-engineering. Will ads care to call
> document.delayLoadEvent()? Will social widgets do that? Where is the
> concrete need for independent script composition? Are the rare use cases
> really worth the additional complexity?

If I'm making part of a site use this feature, I want it to be
self-contained within the code that's actually using the feature, not
messing about with document-global attributes.  This is equivalent to why
we use addEventListener in modules, rather than event handlers.

On Sun, Apr 28, 2013 at 5:08 PM, Robert O'Callahan <robert at ocallahan.org>wrote:

> On Mon, Apr 29, 2013 at 5:47 AM, Glenn Maynard <glenn at zewt.org> wrote:
>> I have to wonder whether authors would really use this, though,
>> regardless of what the API looks like.
> We have FirefoxOS app developers who want to use it. This feature request
> came from them.

If it's only useful for FirefoxOS, then that's where it should live.  Would
it actually be used by authors on the general Web?

Glenn Maynard

More information about the whatwg mailing list