[webkit-dev] Catching events in JavaScript and the onload event

Jussi Kukkonen jussi.kukkonen at intel.com
Mon Oct 1 05:59:33 PDT 2012


On Mon, Oct 1, 2012 at 11:02 AM, Luka Napotnik <luka.napotnik at gmail.com> wrote:
> Hello.
>
> Thanks for the reply. So my best bet is to add some sort of a timeout that
> will trigger the rendering and hoping that the page is fully loaded? If I
> would implement such a signal that triggers itself when all the resources
> are 100% ready(DOM + resources) what's the best place to look at?
>
> And .. is there a way to look if the JS engine idles or is executing code?

Just to add to Mihais answer: A "ready" signal not exist because it's
just not possible to define what that means because scripts can change
things at any point in time. That doesn't mean things couldn't be
easier: There's the img.complete property that you should be able to
use to check on your images but that has some issues that prevent it
from being too useful at the moment.

First, it's not really implemented as specified (if anyone is willing
to look at my patches in webkit.org/b/28832 and webkit.org/b/95440
that would be great). If the implementation was correct it might be
more useful for you than just onload but note that the specification
still explicitly says that the value of img.complete can change during
the execution of your script
(http://www.w3.org/TR/html5/the-img-element.html#dom-img-complete),
even after onload...

HTH,
  Jussi


More information about the webkit-dev mailing list