W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2013

Re: [whatwg] API to delay the document load event

From: James Graham <jgraham@opera.com>
Date: Mon, 29 Apr 2013 12:50:34 +0200
Message-ID: <517E507A.7070908@opera.com>
To: robert@ocallahan.org
Cc: whatwg <whatwg@lists.whatwg.org>
On 04/29/2013 11:42 AM, Robert O'Callahan wrote:
> On Mon, Apr 29, 2013 at 8:56 PM, James Graham <jgraham@opera.com
> <mailto:jgraham@opera.com>> wrote:
>
>     On 04/29/2013 05:26 AM, Robert O'Callahan wrote:
>
>         Also, this is a feature where it's trivial for applications to
>         gracefully
>         degrade on browsers that don't have the feature.
>
>
>     I'm not sure that's true. I mean, it's *possible* but you have to be
>     careful to never depend on anything that could happen after the
>     "natural" load event in e.g. your load event handler. I can quite
>     easily see people getting that wrong.
>
>
> I'm not sure what you're getting at here.

I mean, let's say you delay the load event until after some data has 
loaded over a web socket. If you try to use that data from the load 
event handler it can fail in a racy way in UAs that don't support 
delaying the load event. This also seems like the kind of race that you 
are more likely to win on a local network, so it wouldn't necessarily be 
caught during development.

>     In general this seems quite a scary design. The load event is rather
>     intimately tied in to the lifecycle of the document, and encouraging
>     people to arbitrarily delay it feels like a potential source of bugs
>     and confusion.
>
>
> Adding new things that delay the load event has not been a source of
> bugs and confusion in my experience. Authors do it a lot and we've done
> it in specs too.

So far we have kept the model where the load event is auomatically 
managed by the UA, rather than giving the developer direct control of it.

>     Is getting screenshots of pages for thumbnails really something that
>     needs an author-facing API? In general the concept of "fully loaded"
>     doesn't make any sense for a class of modern web applications, which
>     might keep loading content or changing their presentation across
>     their liefetime. Therefore it seems like simply taking one
>     screenshot at page load and replacing it with one a little later
>     after a timeout might be a good-enough solution.
>
>
> The problem is when you next load the application. You don't want to
> replace a good screenshot with a screenshot of the application saying
> "Loading...".

Then don't replace the screenshot with one taken at the load-event time 
if you already have one.
Received on Monday, 29 April 2013 10:51:08 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:57 UTC