[whatwg] DOMContentLoaded, load and current document readiness

Jonas Sicking jonas at sicking.cc
Tue May 31 10:29:53 PDT 2011

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

More information about the whatwg mailing list