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

Luka Napotnik luka.napotnik at gmail.com
Tue Oct 2 00:26:03 PDT 2012


Ok I understand that the engine works very asynchronous and as both of
you said that it's basically impossible to say when the page is ready
to be rendered.

I still have some questions:

Does WebKit have some sort of 'resource loaded' event that tells which
**known** resources are already loaded or scheduled to be loaded.
And do changes to DOM get deferred till a scheduler picks them up and
changes the tree. Because if this is the case, one could check what's
the load status of DOM.

Greets,
Luka

On Mon, Oct 1, 2012 at 2:59 PM, Jussi Kukkonen <jussi.kukkonen at intel.com> wrote:
>
> 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




--
Greets,
Luka Napotnik,

www: http://napotnik.info


More information about the webkit-dev mailing list