onDOMLoaded() a different approach

onDOMLoaded with Matthias Miller suggested test cases (this was the hardest part)

onDOMLoaded behavior with Dean Edwards test cases (modified only in the event part)

DOMContentLoaded expected behavior (this test case only for Firefox 1.5.x or Opera 9)

Get the onDOMLoaded.js source

Some info on the method used.

The method rely on an XMLHttp request to find the size of the requested URL.
I just send a HEAD request initially (a few bytes), but if the 'Content-Length' is not available
the request is resubmitted with GET method. I know it is slow, the page get transferred twice !!!
No events are used so your events should still work out of the box (I hope). No readyState property
and nearly no browser sniffing except for a difference in the Opera DOM about scripts and styles.

Be sure to enable Javascript writing/modifying the StatusBar if you use Firefox/Mozilla.

I extensively use the StatusBar to output debug info instead of alerts() which many times obfuscate
the real problems and/or may give false result due to the syncronous nature of the alert() function
that will completely stop the currently running browser process, invalidating results especially
during events phases.

NOTES:
This is experimental, many combinations have not been tested yet.
Page sizes and/or slow link combined may reveal bugs/inconsistency.
Please bear with me while I test it and try to make it reliable.
Your comments are strongly appreciated.