Tobie,
current implementations in other libraries are not complete,
everybody opted for a slightly different/shorter approach,
without really understand IEContentLoaded completeness.

You were one between the few that realized that the "doScroll()"
method is not enough by itself, there are edge cases where it still
does not fit the bill. I have had a hard time trying to explain this.

All my trick does is just for IE, just to make the point clear to
others...

Firing before the "onload" event but after all nodes are in is a very
difficult task for IE, nearly impossible just by reading it out,
however
let's split the tasks in two separate objectives for a moment:

1) absolutely precede the "window.onload" event
2) all elements should have loaded and be "scriptable"

Probably, by taking them separately, both objectives have been
reached several times in really different ways. Having both
objectives at the exact same time is much more difficult.
A native method is perfect, but IE does not exposes it.

The complete "hack" relies on more parts, not just the "doScroll()",
the frameworks named above, all opted for only implementing the
"doScroll()" part of the complete IEContentLoaded I worked on.

The original code I linked to in my previous post provides also an
"onreadystatechange" event to avoid those possible situations
you described; it is fired when the document "complete" state
is reached.

In my tests this always fire before window "onload", probably just
few milliseconds before, but that is always ensured (and Dojo
king Alex Russell has already said that long ago).

So I use both methods in combination,  ("onreadystatechange"
event plus "doScoll('left')" trick on "document.documentElement")
both call the same "init()" to ensure user's handlers only fire once.

The situation you described may be engaged by several triggers,
namely when the server sends "Transfer-Encoding: chunked" content
and page is very long, or when small page are cached and you land
on those pages by means of the back/forward browser buttons.

I know there are many more quirks, but I would like to see the test
case were this is failing. Do you think you can cut out for me the
interesting part of it and post here so I can give it a try ?

Diego Perini


On Feb 25, 7:37 am, Tobie Langel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm all for it myself.
>
> I even had implemented it for 1.6.0.2 and had to revert because it was
> making our tests fail.
>
> The problem is that the doScroll technique can trigger the dom:loaded
> event *after* window.onload, notably on short pages. Delegating to
> window.onload in that case doesn't work, as it's not ordered in IE...
> so that's the first thing to solve.
>
> Not impossible, of course, so any implementation that passes our
> current tests is more than welcomed.
>
> Best,
>
> Tobie
>
> On Feb 25, 4:21 am, Diego Perini <[EMAIL PROTECTED]> wrote:
>
> > Don't know if you already tried the doScroll("left") trick,
> > many frameworks already implemented it, YUI and
> > jQuery to name some, but Mootools have it in SVN
> > and tools like sIFR already uses it.
>
> > I proposed this to solve the fact that IE is missing
> > such useful native method. I know many methods
> > exists, each method having his own advantages
> > and disadvantages. This trick is not different in
> > that respect but it has some tasty advantages.
>
> > This is a link to the original code and trick:
>
> >    http://javascript.nwbox.com/IEContentLoaded/
>
> > And here you can find a tentative test case / tester if you
> > want to try out your own code / modifications:
>
> >    http://javascript.nwbox.com/IEContentLoaded/tester.php
>
> > The current pre-loaded javascript is only for IE, but you
> > may paste your code in the text area and see if
> > it fires correctly in your preferred browser.
>
> > Sorry for the colors...and shortness in general.
>
> > Diego Perini
--~--~---------~--~----~------------~-------~--~----~
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