W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2011

[whatwg] DOMContentLoaded, load and current document readiness

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 31 May 2011 10:29:53 -0700
Message-ID: <BANLkTi=E2iSkw+CX_uw-+yw4sLuQLwu3iA@mail.gmail.com>
On Tue, May 31, 2011 at 2:02 AM, Henri Sivonen <hsivonen at iki.fi> wrote:
> Recently, there was discussion about changing media element state in the
> same task that fires the event about the state change so that scripts
> that probe the state can make non-racy conclusions about whether a
> certain event has fired already.
>
> Currently, there seems to be no correct non-racy way to write code that
> probes a document to determine if DOMContentLoaded or load has fired and
> runs code immediately if the event of interest has fired or adds a
> listener to wait for the event if the event hasn't fired.
>
> Are there compat or other reasons why we couldn't or shouldn't make it
> so that the same task that fires DOMContentLoaded changes the readyState
> to "interactive" and the same task that fires load changes readyState to
> "complete"?

This sounds like a good idea to me. In fact, I'm surprised that that
isn't what Gecko already does.

/ Jonas
Received on Tuesday, 31 May 2011 10:29:53 UTC

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