I am currently developing Unit Tests for a Javascript method that detects the readiness of the document. This code is already at framework level, so please avoid mentions of
For some reason, it appears that IE overrides the onload
property of window
with an empty object after the DOM is loaded. At least that is the case when you try to access it from within any event handler of a DOM element...
Test by Josh
Test
In this situation, you'll see that window.onload is recognized as a function initially, then you see the "Test" alert. When you click on the heading, you'll see that window.onload is now an object
. I tried iterating through the properties of the object, but it's empty. This is not cool.
One lame workaround is to grab the function in the accessible scope and assign it to a different property that you can fire at your convenience...
Test by Josh
Test
I can't think of any other way to address this issue right now.