On 9/7/07, jdalton <[EMAIL PROTECTED]> wrote:
>
>
> Before the window onload event is fired I check to see if the
> DOMContentLoaded has been notified or if they equal each other (if the
> browser dosent support any form of  DOMContentLoaded emulation I have
> it fallback on the window onload event)


This is all nice, but your event system differs a lot from what we have in
Prototype 1.6. Let's concentrate on our implementation.

Mozilla and Opera use DOMContentLoaded, IE uses the defer script hack, and
WebKit polls for document.readyState and registers an onload event. All hook
up to a handler called fireContentLoadedEvent. So, in case of WebKit the
handler will always be called twice (on document ready and window.onload),
so we must make sure we stop the second execution. We do so by setting a
flag named "fired". Currently, there is a slight chance that onload event
might happen while a WebKit browser is executing fireContentLoadedEvent and
has not yet set the flag. That's why, IMO, we have to set the flag earlier
in fireContentLoadedEvent.

So, let's proceed to the other usage case. Observe this user code:

  document.observe("contentloaded", handler1)
  Event.observe(window, "load", handler2)

If you are asking can we prevent handler2 from being run before or parallel
with handler1, the answer is: no, we can not.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to